
Ross Micheals
Top achievements
Rank 1
Ross Micheals
asked on 26 Mar 2013, 01:05 AM
The Grid's 'select' event does not appear to fire when rows are 'unselected' after sorting a column. :(
It looks like this has been noticed already; http://www.kendoui.com/forums/ui/grid/change-event-and-row-unselect.aspx
Can this be fixed? Clearly the selection is being changed; this event should fire.
It looks like this has been noticed already; http://www.kendoui.com/forums/ui/grid/change-event-and-row-unselect.aspx
Can this be fixed? Clearly the selection is being changed; this event should fire.
7 Answers, 1 is accepted
0
Hello Ross,
Basically the selection of the rows/cell is nothing more than a simple CSS classes added to the elements when they are clicked. However when the Grid is rebound the table is recreated and all of these css classes are gone.
As a work-around you can use the dataBound event - if it is triggered then the selection is lost.
On a side note if you want to persist the selection you can use the approach from this code library.
Kind regards,
Petur Subev
the Telerik team
Basically the selection of the rows/cell is nothing more than a simple CSS classes added to the elements when they are clicked. However when the Grid is rebound the table is recreated and all of these css classes are gone.
As a work-around you can use the dataBound event - if it is triggered then the selection is lost.
On a side note if you want to persist the selection you can use the approach from this code library.
Kind regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Ross Micheals
Top achievements
Rank 1
answered on 27 Mar 2013, 07:35 PM
Thanks. Why not just add code to fire the 'change' event on sort/filter/group events?
0
Hello Ross,
The change event is triggered on user interaction with the mouse on the table. When the page / sorting etc is changed the dataSource events / Grid dataBound are triggered.
Kind Regards,
Petur Subev
the Telerik team
The change event is triggered on user interaction with the mouse on the table. When the page / sorting etc is changed the dataSource events / Grid dataBound are triggered.
Kind Regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Ross Micheals
Top achievements
Rank 1
answered on 29 Mar 2013, 01:14 PM
I understand the distinction, but I respectfully disagree with that design decision.
The documentation clearly states that the select event "[f]ires when the grid selection has changed." To me, this indicates that the event should fire every time the selection has changed.
Perhaps the documentation might be updated to suggest to users that they may want to consider handling the seemingly unrelated (binding) events for checking for changes to the selection. This might prevent others from facing the same confusion.
PS. You state that the event changes when the mouse is used. If keyboard navigation is used, does the event not fire then either?
The documentation clearly states that the select event "[f]ires when the grid selection has changed." To me, this indicates that the event should fire every time the selection has changed.
Perhaps the documentation might be updated to suggest to users that they may want to consider handling the seemingly unrelated (binding) events for checking for changes to the selection. This might prevent others from facing the same confusion.
PS. You state that the event changes when the mouse is used. If keyboard navigation is used, does the event not fire then either?
0

Adil
Top achievements
Rank 1
answered on 01 Apr 2013, 11:41 AM
Ross, I totally agree with you.Even i am also facing some thing similar.
I need to trigger Change from my Javascript seems it is not working.
I am changing selection of my Grid throug javascript and intern change is not firing so i tried to do with "Trigger" but no success.
Peter any idea or help on using Trigger.
$("#Grid").data("kendoGrid").tbody.find("tr[data-uid='" + dataItem.uid + "']").addClass("k-state-selected"); //working and selection is changed
$("#Grid").data("kendoGrid").trigger('Change'); // not working
I need to trigger Change from my Javascript seems it is not working.
I am changing selection of my Grid throug javascript and intern change is not firing so i tried to do with "Trigger" but no success.
Peter any idea or help on using Trigger.
$("#Grid").data("kendoGrid").tbody.find("tr[data-uid='" + dataItem.uid + "']").addClass("k-state-selected"); //working and selection is changed
$("#Grid").data("kendoGrid").trigger('Change'); // not working
0

Ross Micheals
Top achievements
Rank 1
answered on 01 Apr 2013, 12:06 PM
Adil:
It's probably not ideal, but can you call the event handler itself? The arguments will not be set the same way they would be if the event were triggered 'naturally' however. That may be a reason you could not do it that way.
It's probably not ideal, but can you call the event handler itself? The arguments will not be set the same way they would be if the event were triggered 'naturally' however. That may be a reason you could not do it that way.
0
Hello,
You can also manually trigger the change event programatically when the dataBound event of the Grid occurs.
e.g.
Kind Regards,
Petur Subev
the Telerik team
You can also manually trigger the change event programatically when the dataBound event of the Grid occurs.
e.g.
$(
'#gridName'
).data().kendoGrid.bind(
'dataBound'
,
function
(e){
this
.trigger(
'change'
)
})
Kind Regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!