Uncaught TypeError: Cannot call method 'call' of undefined

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”}
]

Change the cancel button as

{type:"button", label:"Cancel", align:'center',width: 100, click:"end_popup"}	

and

start_popup logic as

function end_popup(){ $$('myWindow').hide(); } function start_popup(id) { $$("myWindow").show(); } dhx.ui(newWindow).hide();

As result the window will be created only once, and instead of full closing, will be just hidden

Thank you.
This time I am able to open the window again but when I see the error console, I am getting the same error again.

I have put the statement “dhx.ui(‘myWindow’).hide();” in "dhx.ready(function(){ " Since dhx.ready function executes once, ‘myWindow’ will get created only once. Am I right…? Or should I put it somewhere else…?
And why am getting the same error again…?

will get created only once. Am I right…?
Yep it is correct

Original issue was triggered by using js command in “click” attribute , which currently can hold only name of method to call, and not the logic itself. If you have moved command to hide window in separate function - it must be resolved

Thank you. I will check.