Hello,
I have a grid in a Layout. When I click on a cell I display a modal dialog using the following code. It works great the first time.
if (stage == 1) {
inputWindow.enableAutoViewport(true);
var cell = myGrid.cellByIndex(rowId,cellInd);
var x = myLayout.cells(“c”).getWidth();
var y = myLayout.cells(“c”).getHeight();
windowHandler = inputWindow.createWindow(“changeWindow”,0,0,300,250);
inputWindow.window(“changeWindow”).center();
windowHandler.keepInViewport(true);
windowHandler.setModal(true);
windowHandler.setText(“Adjust Order”);
windowHandler.attachObject(“changeDialog”);
}
I then close the dialog using the “X” window decoration. If I click on another cell this code is re-entered and I get a Javascript error “Object required” within the dhtmlxwindow code. It fails on the “attachObject” call.
To work around this I decided to attach an “onClose” event to the window. It will call a function to hide the modal dialog (dhxWin.hide()). It hides the window but the Viewport is inactive.
Not sure what to do about this. Basically I don’t want to keep creating/destroying a window to avoid any possible overhead.
Thanks.
-Doug
Hello,
you can try to use the following approach to redefine “close” button behaviour:
windowHandler.button(“close”).close = function() {
windowHandler.hide();
}
This method allows to hide/show the window on cell click instead of creating the new window eahc time. So, windowHandler = inputWindow.createWindow(“changeWindow”,0,0,300,250); … code should be executed only once. And on click event handler should just call windowHandler.show();
Yes, but if it’s a modal window and you “hide” it then the background is still unclickable. On the events I had to do the following, which is a bit odd:
onClose:
windowHandler.setModal(false);
windowHandler.hide();
onEditCell:
windowHandler.setModal(true);
windowHandler.show();
If I don’t do this then I can’t click on anything in the background after the onClose. In my opinion this is a bug. When a modal dialog is hidden the background should not be disabled.
The background is automatically disabled only when modal window closes. The hide() method doesn’t close the window. So, it is necessary to call setModal method manually.