PDA

View Full Version : Stop scripts running when window closed with right corner cross button [x]



ErwanGouyette
1 Dec 2016, 7:57 AM
Hello,

Sorry if the subject has already been treated. If it's the case, please give me the link.

I'm working on an application with Ext JS in version 3.2.1.

The problem I encounter is Javascript referencing properties of elements from a closed window which causes null reference errors.

Here are the details.

The application opens on a main window with links. When the user clicks on 1 of these links, a new window appears.
Then, after various manipulations in this window, the user submit the formular.

The submit action is handled with a "doAction" instruction. Inside this instruction, in the callback, some instructions refer elments from the current window before closing it.

The problem occurs when it takes time on the server side (after submitting - eg : database maniupulations, ... ).
When it's the case, the user often looses patience and quits the window by clicking on the right corner cross button [x].
Then the callback from the "doAction" instruction fires and references elements from the the window which has been closed by the user, and that causes Javascript errors.

Do you know if there's a simple instruction with ExtJS which permits to stop all running scripts ?
Otherwise, what mechanism could you recommend to implement to prevent those errors ?

Thank you, regards,

Erwan

Gary Schlosberg
1 Dec 2016, 8:57 AM
Would it work to eliminate the close tool from the window?
http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.Window-cfg-closable

ErwanGouyette
2 Dec 2016, 1:26 AM
Hello Gary,

Thank you for replying so fast.

In fact this problem concerns many functionalities of the software (the [x] button case is just an example to explain the problem I'm facing).

Thus, rather than preventing the user from accessing functionalities I'd prefer to implement a "global" mechanism or use an instruction which in order to stop running scripts.

In my opinion, an instruction (in the taste of "Ext.Manager.stopAll()") would be the easiest way to resolve this problem.

Would you recall an instruction of this kind ?

Do you have any advice about managing this issue ?

Thank you, regards,

Erwan