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

189 Views Asked by At

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?

1

There are 1 best solutions below

0
On

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

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

Then target the correct item using its id.