I am trying to dynamically add accordion item views to an existing accordion.
I want to do $$(‘accordion’).addView(myAccordionItem) to add to the accordion, and not pass in the configuration.
Is this possible?
I see that addView() works if pass in a configuration file, but if I pass in an instance an exception is thrown.
Please see my code below:
webix.ready(function(){
var app = webix.ui({
container:"app",
view:"accordion",
multi:true,
id: 'accordion',
cols:[ //or rows
{
header:"col 1",
id:'col1'
},
{ header:"col 2", body:"content 2" },
{ header:"col 3", body:"content 3" }
]
});
var config = {
view:"accordionitem",
header:"dyn header",
body:"dyn body"
};
// This works
//$$('accordion').addView(config);
// This does not work
var view = webix.ui(config);
$$('accordion').addView(view);
});