This very simplified code gives you an idea of what I’m trying to do. I’ve replaced the carousel with a Multiview to see if that would work better but it still has the same problems.
var data1 = [{LineNo:1,Description:“Desc1”,id:1},
{LineNo:2,Description:“Desc2”,id:2}];
var data2 = [{LineNo:3,Description:“Desc3”,id:3},
{LineNo:4,Description:“Desc4”,id:4}];
var cols = [{id:“LineNo”,header:“Line No”},
{id:“Description”,header:“Description”}];
var view = {view:“form”, localId:‘tableform’, name:“tableform”, elements:[
{view:“datatable”, localId:‘mytable’, name:“mytable”, select:‘row’, columns:cols,
on:{“onItemDblClick”:function() {var item = this.getSelectedItem();
webix.message(item.id)}}
}
]};
webix.ui({rows:[
{
view:“multiview”,
id:“mymultiview”,
width:464, height:275,
cols:[{id:“dummy”}]
},
{
view:“toolbar”, id:“mytoolbar”, type:“MainBar”, elements:[ ]
},
]},
).show();
$$(“mymultiview”).removeView($$(“dummy”));
var zview = webix.copy(view);
$$(“mymultiview”).addView(zview,-1);
$$(“mymultiview”).getChildViews()[0].queryView({name:‘mytable’}).parse(data1);
var btn = {view:“button”,id:0,value:“table1”,click:buttonhandler};
$$(“mytoolbar”).addView(btn,-1);
var xview = webix.copy(view);
$$(“mymultiview”).addView(xview,-1);
$$(“mymultiview”).getChildViews()[1].queryView({name:‘mytable’}).parse(data2);
var btn2 = {view:“button”,id:1,value:“table2”,click:buttonhandler};
$$(“mytoolbar”).addView(btn2,-1);
function buttonhandler(id) {
var mviews = $$(“mymultiview”).getChildViews();
for (i = 0; i < mviews.length; i++) {
if (i == id) mviews[i].show();
}
}
In this code snippet I can’t get the button handler to work. I don’t realy want to use the tab object or the segmented button for this but generate my own buttons as the user adds views.
In my actual code the switching of views with the buttons works ok, but each time I add a view to the Multiview, the data in the previous views still displays but the code in the itemDblclick event returns a ‘undefined’ item.
Hope this helps to give you an idea of what I’m trying to do.
Thanks,