Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Adam Downs on Jun 19, 2009 05:49
open dhtmlx forum
Controls Unavail on reopened Popup Window

I have a Grid that I added a context menu to...

when the user opens the row details from the context menu, I open a new dhtmlx window which attaches a jsp URL as a form.
the user edits the data then submits. That form posts to a save jsp url and then the save url closes the window. This All works fine However when the user trys to reopen a new row detail the controls on the same form are now disabled...

dhxWins is declared as a Global

To Open the Window with the form I use the following from the context menu:
function editVendor(vendorId){
    dhxWins = new dhtmlXWindows();
    var wl = dhxWins.createWindow("wl",25,25,500,350);
    wl.setText("Edit Vendor");
    wl.attachURL("vendorDetails.jsp?ID="+vendorId);
}
The vendorDetails page posts to another page that saves the details then uses the following to close the popup window :
parent.dhxWins.window("wl").close();

If I dont use the script to close the form, and simply use the close button on the form, the form resets the controls on next open which is the desired effect... How can I obtain the same effect without using the window close "BUTTON"

I am using dhtmlxSuite_2009Rel1_pro_90226
Answer posted by Alex (support) on Jun 19, 2009 07:24

hello,

close button calls the close() method. So, both approaches are the same.

But possibly using editVendor in such a way isn't optimal.

It will be better to create window one and reload iframe. In this case you can hide window.

This code is called only once:

dhxWins = new dhtmlXWindows(); 
var wl = dhxWins.createWindow("wl",25,25,500,350); 
wl.setText("Edit Vendor");


and when you need to show new window:

function editVendor(vendorId){

w1.show();

var url = "vendorDetails.jsp?ID="+vendorId;

if(w1._iframe) w1._frame.src = url;

else w1.attachURL(url);

}

and parent.dhxWins.window("wl").hide(); to "close" window.

If the issue still persists, please provide a direct link to the problematic page ( you can send it to support@dhtmlx.com )

Answer posted by Adam Downs on Jun 19, 2009 07:59

I solved this issue by adding the following to gain focus to a control as my issue was only found in Internet Explorer... Thanks for the prompt reply...

dhxWins.attachEvent("onContentLoaded", function(win) {

if (_isIE && win.getId() == "wl") {

if(win._frame.contentWindow.document.getElementById("txtName")!=null){

win._frame.contentWindow.document.getElementById("txtName").focus();

}

}

});