Hello,
I can’t figure out how to insert a JetView into a tabview or multivien.
Their respective methods addView expect a jsonConfig object to build the new view, so, I’ve tried many things without success.
Here are the 2 views involved:
// form.js
import { JetView } from "webix-jet";
export default class ViewForm extends JetView {
config() {
return {
template: "My form"
}
};
init() {
//...
}
}
// main.js
import { JetView } from "webix-jet";
import ViewForm from "./form";
export default class ViewMain extends JetView {
config() {
var tabbar = {
id: "app-tab-bar",
view: "tabbar",
multiview: true,
options: [
{ value: 'First tab', id: 'app-nav', close: false, width: 320 }
]
};
var ui = {
id: "app-root",
cells: [{
id: "app-nav",
template: "Content of tab 1"
}]
};
return {
rows: [
tabbar
ui,
]
}
}
}
How can I add my JetView in the multiview?
The following works (badly) and is a horrible hack. Furthermore, when we do this, we lose the benefits of the JetView api (auto init, events…) :
let form = new ViewForm();
let formConfig = form.config();
// Add a new content area
$$("app-root").addView(formConfig);
// Add a new tab
$$("app-tab-bar").addOption(formConfig.id, formConfig.id.toString(), true);
So, what’s the proper way to add a JetView in to a multiview layout?