Attach Layout dynamically

Hey!

I would like to create a Framework for reports that works pretty dynamically.
In a base framework I habe defined some Tabs and filled it with a layout (3W). the ‘a’-cell of that layout is filled with an accordion and those cells contain dataviews. according the selection of the dataview, the ‘b’-cell of the main Layout gets another layout attached,… there are some more steps, but there’s where difficulties begin:
I’m facing the problem that the layout/cell into which i want to attach a new layout is not known to the machine…

Error happens in function ‘insertLayout’ on the usage of variable tab.

Is there anything I need to do in order to make tab point to the correct Object?

Best Regards,
Chris
dynAttachLayout.zip (2.37 KB)

Hi

any words how to reproduce?

Hey!

Well, I attached the onItemClick Event to the dataviews, calling function reportSelect.
In there, I extract (part of) the contents from the data loaded into the DataView.

with this data I want to insert a new Layout by calling insertLayout function, having parameter tab and layout. tab contains the name of the Layout, which cell(‘b’) i want to insert the new layout into. But using the variable tab doesn’t work. Using the name tabLay_KA would work, but then it’s no longer dynamic.

[code]function reportSelect(id) {;
var report = this.get(id);
var p_name = report.name;
var p_id = report.id;
var p_ge = report.graphentries;
var p_lay = report.layout;
var p_tab = report.tab;

insertLayout(p_tab, p_lay);

}

function insertLayout(tab, layout) {
myGTab = tab.cells(“b”).attachLayout({pattern: layout, cells: [ /* Error when using ‘tab’ if I used ‘tabLay_KA’ everything would be fine /
{id: “a”, text: “inner layout a”}, {id: “b”, text: “inner layout b”} /
definition here is mock-up */
]});
}[/code]
dynAttachLayout_v2.zip (2.26 KB)