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

KendoGrid command click event triggered multiple times

3 Answers 1670 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mikael
Top achievements
Rank 1
Mikael asked on 04 Apr 2013, 09:08 AM
I have a Kendo grid presented in a mobal window (kendoWindow). The grid has a column command with a click event:
$("#grid").kendoGrid({
...
columns:[
...
{ command: { text: "Details", click: showDetails }, width: "60px" }],
}];

The first time I open the window everything works fine, each time i click on a Details button on a row the showDetails method is called.
However, after closing the windows and opening it again, the event is fired twice. In fact as many times as I've opened the modal window.

Is there a way to unregister the event handler on the grid?

3 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 05 Apr 2013, 01:13 PM
Hi Mikael,

 
I tried to reproduce the problem locally but to no avail – the click event is triggered only once. Could you please provide runable project where the issue is reproduced? This would help us pinpoint the exact reason for this behavior.

Kind Regards,
Vladimir Iliev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Mikael
Top achievements
Rank 1
answered on 05 Apr 2013, 03:08 PM
Thanks for taking the time. Here is a jsfiddle samle:
http://jsfiddle.net/T89mG/1/
0
Vladimir Iliev
Telerik team
answered on 08 Apr 2013, 05:38 AM
Hi Mikael,

 
After reviewing the provided jsFiddle it seems that the issue comes from initializing the grid every time the window is opened which is invalid configuration. I would suggest in the click event of the button to check if the grid is already initialized to only open the window. For convenience I updated the provided jsFiddle.

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