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

Row changed event trigerd before checkbox state status.

2 Answers 80 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ianc
Top achievements
Rank 1
ianc asked on 22 Feb 2014, 06:04 PM
H I have simple grid with checkboxes column. What I want to achieve is to select checkbox when one of two states will happen
1. I click on the row
2. I click on the checkbox

In kendo there is one event 'change'  which is triggered by the two states above.

My logic is following
When I click the row  then in change event i change property of the checkbox to select it the problem is that the same happen if I click checkbox in that row and then I can distinguish what is the source of triggering and again I am changing state of the checkbox.

Unfortunately this change event is triggered before checkbox selection put break in change event and click checkbox you will see that checkbox is not selected yet but even is triggeredand because I can distinguish the source I am trying to change state of the checkbox again and then there is conflic with DOM because after that occurs checkbox it's own event and is trying to manipulate its state again.

I would attache sample but it takes with all libraries 15 mega bytes which is much more then allowed 2 mega.
But I am including my view with all javascript and controller with repository class

2 Answers, 1 is accepted

Sort by
0
ianc
Top achievements
Rank 1
answered on 22 Feb 2014, 10:07 PM
I will answer my self but would be nice if anyone can confirm, for me the solution was to add onclick='return false' to the checkbox to prevent its own bubbling but for me this is more like trick then elegant solution. 
0
Nikolay Rusev
Telerik team
answered on 26 Feb 2014, 07:40 AM
Hello Ianc,

Here is one way to achieve the desired functionality: http://jsbin.com/ganut/1/edit

 - selecting a row will check the checkbox and will remove the selected state from all others
 - click on checkbox will check the input and mark the row as selected

Regards,
Nikolay Rusev
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
ianc
Top achievements
Rank 1
Answers by
ianc
Top achievements
Rank 1
Nikolay Rusev
Telerik team
Share this question
or