The script below shows a table. A new window opens when I click on a row. After that I click on ‘cancel’ and the window closes. When I click on a row one more time. It gives an error “Uncaught TypeError: Cannot call method ‘call’ of undefined(touchui.js:241)”.
Can anyone help me please.
Following is my code
.js file
dhx.ready(function(){
dhx.ui({
rows:[
{
view:“toolbar”,
type:“MainBar”,
data:[
{type:“label”, label: “Spreadsheet”, align:“center”}
]
},
{
view:“grid”,
id:"grid",
header:true,
fields:[
{ id:"name", label:"Name",width:150,template:"#name#"},
{ id:"phone",label:"Phone",width:150,template:"#phone#"}
],
datatype:"json", // the type of the data by which we will fill grid up
url:"data.json" // the relative path to our xml file
},
{
view:"toolbar",
type:"SubBar",
data:[
{type:"roundbutton", id:"add", label:"Add", align:"center"},
{type:"roundbutton", id:"modify", label:"Modify", align:"center"},
{type:"roundbutton", id:"delete", label:"Delete", align:"center"}
]
}
]
});
$$('grid').attachEvent("onafterselect", start_popup);
});
var newWindow={
view:“window”,
id:“myWindow”,
head:{
view:“toolbar”,
type:“MainBar”,
data:[
{type:“label”, label: “Selected Row”, align:‘center’}
]
},
body:{
rows:[
{
view:“form”,
data:[
{type:“text”, id:“name”,label:‘Name’, value: “”, position: “label-left”, width:250, inputWidth: 150, labelWidth: 100, align: “left”, labelAlign: “left”},
{type:“text”, id:“phone”,label:‘Phone’, value: “”, position: “label-left”,width:250, inputWidth: 150, labelWidth: 100, align: “left”, labelAlign: “left”}
]
},
{
view:“toolbar”,
type:“SubBar”,
data:[
{type:“button”, label: ‘Save’, align:‘center’, width: 100},
{type:“button”, label:“Cancel”, align:‘center’,width: 100, click:"$$(‘myWindow’).close()"}
]
}
]
},
position:“center”
};
function start_popup(id)
{
dhx.ui(newWindow);
}
data.json file
[
{id:1,name:“A”,phone:“123”},
{id:2,name:“B”,phone:“456”}
]