Dear Sir,
I have a layout, attach(toolBar), layout.cells(“a”).attachAccordion and layout.cell(“b”).attachform, but when I change the accordion’s item. The layout.cell(“b”).attachform is disappeared, so I use the layout showView function, it can be show it.
[url]https://dhtmlx.com/docs/products/dhtmlxLayout/samples/01_init/09_views.html[/url]
Now, the “companyProfileForm” of form can saved. But the problem is when I used the showView function, the “companyProfileForm1” of form can not saved.
myToolbar = myLayout.attachToolbar({
icons_path: "../dht/skins/toolBarIcon/",
xml: "../xml/factoryToolBarIcon.xml"
});
myToolbar.attachEvent("onClick", function(id) {
if(id == "save"){
dhtmlx.alert("Saved!");
companyProfileForm.save();
[i][b]companyProfileForm1.save();[/b][/i]
}
});
myAcc = myLayout.cells("a").attachAccordion({
icons_path: "../dht/skins/accordionIcon/",
skin: "material",
items: [
{ id: "companyProfile", text: "Company Profile", icon: "flag_green.png" },
]
});
myAcc.attachEvent("onActive", function(id, state){
if(id == "companyProfile"){
showView("companyProfile");
}
});
var companyProfileFormData = [
{ type: "settings", position: "label-left", labelAlign:"right",labelWidth: 100, inputWidth: 200, offsetLeft: 10 },
{ type:"input" , name:"companyName_Eng", label:"companyName_Eng:"},
];
var companyProfileForm =myLayout.cells("b").attachForm(companyProfileFormData);
var dp = new dataProcessor("../php/factory/factoryProfile.php");
dp.init(companyProfileForm);
companyProfileForm.load("../php/factory/factoryProfile.php?id=1");
ShowView Function :
function showView(view) {
var firstShow = myLayout.cells("b").showView(view);
if (firstShow) {
if (view == "companyProfile") {
var companyProfileFormData1 = [
{ type: "settings", position: "label-left", labelAlign:"right",labelWidth: 100, inputWidth: 200, offsetLeft: 10 },
{ type:"input" , name:"companyName_Eng", label:"companyName_Eng:"},
];
var companyProfileForm1 =myLayout.cells("b").attachForm(companyProfileFormData1);
var dp1 = new dataProcessor("../php/factory/factoryProfile.php");
dp1.init(companyProfileForm1);
companyProfileForm.load("../php/factory/factoryProfile.php?id=1");
}
}
}
Could you give me the ideas, how to solve it.
many thanks,
Kenneth