Lawless Leopard
Lawless Leopard

Reputation: 69

Golden Layout Library - How do I access the controlsContainer of a specific component?

I have the following Layout:

myLayout = new GoldenLayout({
    content:[{
        type: 'row',
        content:[{
            type: 'component',
            componentName: 'testComponent',
            componentState: {},
            id:"Widget-1"
        },{
            type: 'component',
            componentName: 'testComponent',
            componentState: {}
        }]
    }]
});

How do I access the "controlsContainer" for the component with id="Widget-1".

I have tried using myLayout.root.getItemsById("Widget-1").controlsContainer.prepend( DropDown );

but I cant access it. Any thoughts?

Upvotes: 0

Views: 332

Answers (1)

Lawless Leopard
Lawless Leopard

Reputation: 69

Got it, just loop through all items of the stack using

myLayout.on( 'stackCreated', function( stack ){}

Then target the correct item using its id.

Upvotes: 1

Related Questions