dhxWins - Multiple Times Issue

I have a popup dialog using the dhxLayout.dhxWins method. It works fine the first time, but if the dialog is closed, and used again on the same page, it gives the following error:



dhxLayout.dhxWins.setImagePath is not a function



Here is the function code:



function dialog_show_confirm_delete(rec_count, action_handler, tb, ids)

{

var winId = “diag_delete”;



//dhxWins = new dhtmlXWindows();

dhxLayout.dhxWins.setImagePath("/_components/dhtmlxWindows/codebase/imgs/");

dhxLayout.dhxWins.createWindow(winId, 0, 0, 400, 160);

dhxLayout.dhxWins.attachEvent(“onContentLoaded”,function(win){

var diag_frm = document.getElementById(“DIAG_FRM”);

inputSubmit(diag_frm.diag_confirm);

inputSubmit(diag_frm.diag_cancel);

});



dhxLayout.dhxWins.attachEvent(“onClose”,function(win){

this.processor_callback = function(loader)

{

show_notice(“error”, “Record(s) Deleted”, “The Records Have Been Deleted From The System Successfully”);

var tmp_arr=new Array();

tmp_arr[0]=“refresh”;

tb.callEvent(“onClick”, tmp_arr)

}

var diag_frm = document.getElementById(“DIAG_FRM”);

if(diag_frm.action_value.value==1)

{

// user has confirmed the delete prompt

dhtmlxAjax.post(action_handler, “del_ids=”+ids, associateObjWithEvent(this, “processor_callback”));

}

var rid = win.getId();

dhxLayout.dhxWins.unload(rid);

win = null;

});



dhxLayout.dhxWins.window(winId).setIcon(“user/delte.small.png”);

dhxLayout.dhxWins.window(winId).setText(“Delete “+rec_count+” Record”+((rec_count > 1)?“s”:"")+" ?");

dhxLayout.dhxWins.window(winId).denyResize();

dhxLayout.dhxWins.window(winId).button(“park”).disable();

dhxLayout.dhxWins.window(winId).center();

dhxLayout.dhxWins.window(winId).setModal(true);

dhxLayout.dhxWins.window(winId).attachURL("/cp/inc/dialog/diag.delete.php?rec_count="+escape(rec_count), true);

}

Could you please provide a complete demo to recreate the issue

Not really in a format that can be ported public at the moment…

I can tell you that if I modify that function and use the dhxWins = new dhtmlXWindows(); component directly and not the Layout version on Wins, there is no issue at all…