https://snippet.dhtmlx.com/6gpnwrbl
I’m running a script to destruct a window containing a form.
If the form has any input/textarea type controlls, script error occurs.
pls confirm. thx
https://snippet.dhtmlx.com/6gpnwrbl
I’m running a script to destruct a window containing a form.
If the form has any input/textarea type controlls, script error occurs.
pls confirm. thx
Hello, I noticed that if you use the awaitRedraw function the error does not occur.
function destroy() {
dhxwindow.hide();
dhx.awaitRedraw().then(() => {
dhxwindow.destructor();
})
}
However, I have this problem using DHTMLX Optimus, up to version 8.3.7 it works normally, after that an exception occurs. I have a window, and I switch between the views (with layout and form attached), through events, and when call the destroy() method of the view to be removed, the following error occurs:
@sematik could you do some tests trying to simulate the error please? At the moment I didn’t have time to make a demo available, but if I can’t simulate it I can take some time to do it.
Thank you very much in advance
In the same way I managed to “solve” the problem by first removing the old view, and using awaitRedraw to attach the new view.
However, these exceptions should not occur, I think.
this.layout.getCell("containerEditLayoutSistema").detach();
dhx.awaitRedraw().then(() => {
this.show(this.layout.getCell("containerEditLayout"), selectedTab, {...});
});
Hello, @sematik I noticed that the problem with destructor was fixed automatically. However, if I call layout.destructor() explicitly, an exception is thrown. Below is the previous example in an updated form within the destroy() function:
https://snippet.dhtmlx.com/3mqvvyie
Edit: in this case I have a layout attached to the window, and the form is attached to the layout.
Hello.
You should wait until layout destructs, and destruct the window only after the layout destructed:
https://snippet.dhtmlx.com/4dqpmhiz
So, as the demo illustrated, could I conclude a general recursively destroy template:
function Current_destroy(){
Son1_destroy(); Son2_destroy(); // If Exsits
dhx.awaitRedraw().then(()=>{
Current.destructor();
});
}