Is it possible to realize tabview’s addView and removeView logic using webix jet concept? How can I add a cell into existing tabview?
Every time you switch to the needed page, it gets re-initialized from the original state (array of cells). In such case, you need to modify this state on each add/removeView command.
@Listopad is there a “proper” way to add a cell into existing tabview? should I use common addView or a way like defining { $subview: true }
?
There’s no any “jet-way” to implement this. In addition to addView()
, the array of the tabs has to be stored and modified according to the actual configuration of the tabview. For instance, within a session it may look as follows:
in models/tabs
:
define([],function(){
var cells =[ /* initial tabs */ ];
return {
cells:cells,
addNewTab:function(obj){ cells.push(obj) } // defining a custom method
};
});
in views/tabview
:
define([
"models/tabs"
],function(tabs){
var ui = {
rows:[{
view:"tabview",
id:"tabview1",
cells:tabs.cells
},{
view:"button", click:function(){
var tab = { /* tab config */ };
$$("tabview1").addView(webix.copy(tab));
tabs.addNewTab(tab); // adding the tab to the array
}
}]
};
return {
$ui: ui
};
});
thanks. that’s clear.