Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Posts: 181
Registered: ‎07-19-2012
My Device: Q5, Q10, Z10, Z30, PlayBook
My Carrier: Carrier

How to change Container Layout?

When I do container.setLayout(DockLayout); from JavaScript it works (no error) but the container layour does not change.

If you find my post helpful please "like" it and "accept as a solution"
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: How to change Container Layout?

[ Edited ]

Untested, but should work:


attachedObjects: [
  ComponentDefinition {
    id: dockLayoutFactory
    content: DockLayout {}
container.layout = dockLayoutFactory.createObject(container);


or a single liner (less efficient):

container.layout = Qt.createQmlObject('import bb.cascades 1.0;DockLayout{}', container, 'codeSnippet');

 'codeSnippet' is pseudo-filename used for error reporting. Replace it with any string.

Andrey Fidrya, @zmeyc on twitter