This is a migrated thread and some comments may be shown as answers.

Grid popup editor's close event fired twice

3 Answers 1150 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Casimodo
Top achievements
Rank 1
Casimodo asked on 08 Mar 2016, 11:20 PM

Hi,

the grid popup editor window's close event is fired twice when closing the popup window via the close button (not the cancel or save button).

See this dojo: http://dojo.telerik.com/IdIYe

Even using the "one" binding produces a duplicate event:

edit: function (e) {
    e.container.data("kendoWindow").one("close", onEditorClosed);
}

I depend on this event being fired only once, because I'm trying to fix my previous issue with flashing nested modal windows (http://www.telerik.com/forums/avoid-overlay-flash-with-nested-modal-windows).

I tried to debug the code: _close() of window is called twice, once via _windowActionHandler() and once via _destroyEditable() -> close(). The strange thing is that both code paths seem to operate on different _events objects. The first code path calls and removes the "one" event handler from _events, but on the second path, _events appears to be unchanged, i.e. the "one" event handler is still there and called again.

Any clues? Looks like a bug to me.

Regards

Kasimier Buchcik

3 Answers, 1 is accepted

Sort by
0
Accepted
Konstantin Dikov
Telerik team
answered on 09 Mar 2016, 03:35 PM
Hi Casimodo,

You have correctly pinpointed the root of the problem, where the close method of the Window is called manually within the _destroyEditable function, even if the close button was clicked. You have two options for handling this limitation:
  • Handle the "deactivate" event of the Window, instead of the "close" event: 
edit: function (e) {
  e.container.data("kendoWindow").one("deactivate", onEditorClosed);
},

  • Use the "save" and "cancel" events of the Grid:
cancel: function(e){
  onEditorClosed();
},
save: function(e){
  onEditorClosed();
}

Hope this helps.


Regards, Konstantin Dikov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Casimodo
Top achievements
Rank 1
answered on 10 Mar 2016, 06:34 PM

Hi Konstantin,

I'm not sure if the main worrying issue really came through.

The call to close() via _destroyEditable() is only responsible for triggering the duplicate "close" event twice. This could be normally be worked-around by using the "one" event binding.

Please try to debug this scenario using a "one" event binding. The _events object (or maybe even an ancestor object of it) appears to be duplicate. Both code paths effectively operate on a different set of event bindings. Why does the already removed "one" event binding reappear in _events when close() is called via _destroyEditable()? I think, this should worry us more than the duplicate call to close().

I am now binding to the "deactivate" event as you suggested. Works fine.

Regards & thanks

Kasimier Buchcik

0
Konstantin Dikov
Telerik team
answered on 14 Mar 2016, 07:46 AM
Hello Kasimier,

I am glad to see that everything works correctly with the suggested approaches.

As for the duplicate "close" event, I will forward this to our developers team for further investigation. 


Best Regards,
Konstantin Dikov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Casimodo
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Casimodo
Top achievements
Rank 1
Share this question
or