Hi sir,
I have a problem of datastore between Grid and Form, I wanna know when I input the new dept in the form, press button of process then it will bring the new dept in the Grid, I try to many time, it is incorrect and cannot bring the data in the Grid.
Could you tell me which part is incorrect. Many thx.
if(id == “createNewDept”){
myLayout2 = myLayout.cells("c").attachLayout({
parent: document.body,
pattern: "2E",
skin: "dhx_web",
cells: [
{id: "a", text: "Departments"},
{id: "b", text: "Create New Department"}
]
});
myGrid = myLayout2.cells("a").attachGrid();
myGrid.setImagePath("dht/codebase/imgs/");
myGrid.loadXML("xml/createDeptGrid.xml");
myForm2 = myLayout2.cells("b").attachForm();
myForm2.loadStruct("json/createDeptForm.json");
myForm2.attachEvent("onButtonClick", function(name){
if(name == "proceed"){
myGrid.bind(myForm2);
}
});
}
xml/createDeptGrid.xml
<?xml version="1.0" encoding="UTF-8"?> Dept ID Department Name<row id="1">
<cell>1</cell>
<cell>Administrative Dept</cell>
</row>
<row id="2">
<cell>2</cell>
<cell>Finance Dept</cell>
</row>
<row id="3">
<cell>3</cell>
<cell>I.T Dept</cell>
</row>
<row id="4">
<cell>4</cell>
<cell>Logistic Dept</cell>
</row>
<row id="5">
<cell>5</cell>
<cell>Merchandising Dept</cell>
</row>
<row id="6">
<cell>6</cell>
<cell>Sales Dept</cell>
</row>
json/createDeptForm.json
[
{type: “settings”, position: “label-left”, labelWidth: 700, inputWidth: 200},
{type: “fieldset”, label: “Create Department Form”, inputWidth: 340, list:[
{type: “input”, label: “Create New Department”,name: “createNewDept”},
{type: “button”, value: “Proceed”, name: “proceed”}
]}
]