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

Control action in Kendo window gets called multiple times

2 Answers 269 Views
Window
This is a migrated thread and some comments may be shown as answers.
Achilles
Top achievements
Rank 1
Achilles asked on 06 Aug 2013, 05:43 AM
Hi,

I have a MVC kendo grid, representing a list of items, on which I use some custom commands.
I also have a invisible kendo window created which I later use to confirm the custom command.
I'd assume that if I call open() and close() on the window control, it would be on the same instance.

What I notice is that if I call the custom command on one item & but don't confirm it, and then call it for the same/another item, the event bound to the confirmation control gets called as many times as I had called the window.open() function before, without having refreshed the page. It appears that each time a new instance of the window is created & it stays somewhere in the cache

Is it possible to suppress this behaviour ? I'm attaching a small sample project to illustrate the problem I'm facing

Kind Regards

Achilles

2 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 07 Aug 2013, 04:01 PM
Hi Achilles,

The "yes" and "no" click handlers are attached inside the DeleteItem(e) handler, which of course means that they will be attached multiple times - upon each click on a delete button.

In addition, a "no" click handler is also attached inside the Window's partial view.

Please refactor the algorithm.

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Accepted
Achilles
Top achievements
Rank 1
answered on 08 Aug 2013, 09:28 AM
Hi Dimo,

Thanks for the hint.
Now I'm unbinding all clickHandlers (if any) in the deleteItem handler before creating a new binding. And this is working quite well for me .

Thanks again &

Regards

Raja
Tags
Window
Asked by
Achilles
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Achilles
Top achievements
Rank 1
Share this question
or