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

Grid Sort Event

9 Answers 530 Views
Grid
This is a migrated thread and some comments may be shown as answers.
J
Top achievements
Rank 1
J asked on 04 Apr 2012, 09:57 PM
Hi,

Is it possible to capture the event when a grid is sorted and to know on which column it was sorted by?

J

9 Answers, 1 is accepted

Sort by
0
David
Top achievements
Rank 1
answered on 05 Apr 2012, 02:40 PM
I know the dataBound event fires, but I would also like to know if there's a way to tell if that's a sort as opposed to anything else.
0
Rolando Rosales
Top achievements
Rank 1
answered on 11 May 2012, 07:21 PM
this would be nice!
0
Basem
Top achievements
Rank 1
answered on 23 May 2012, 11:21 PM
+1 for this!
0
James Shelton Agar
Top achievements
Rank 2
answered on 04 Jul 2012, 10:53 PM
+1 The only workaround I can think of is to return the sorting param in JSON...which is....mmmm
0
Vikas
Top achievements
Rank 1
answered on 10 Apr 2013, 07:37 AM
+1. Really need this to identify whether the grid was sorted, paginated, filtered. As of now there is no  way to identify it. Is there a workaround for this? 
0
Michael
Top achievements
Rank 1
answered on 18 Aug 2014, 07:55 PM
+1, hopefully bumping this thread up

I could really use an event callback for the "sort" event for a grid since I want to re-initalize some custom HTML-based click handlers that go away once the grid is sorted (and I assume the HTML objects are re-created)
0
Dimiter Madjarov
Telerik team
answered on 21 Aug 2014, 10:48 AM
Hello Michael,


There is no sort event available in the dataSource. This suggestion is posted in our user voice portal. If you consider that it will be useful addition to the framework, you could place your vote there. If it becomes popular among the community, we will consider to implement it in future releases.

As for the exact case, you could use the sort() method of the dataSource to retrieve the current sort configuration and compare it will the previous one. For example a JS variable could be used to store the previous sort configuration.

I hope this information helps.

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Michael
Top achievements
Rank 1
answered on 21 Aug 2014, 07:44 PM
Hey Dimiter, 

Thanks for your response. It looks like the Data Bount Event might be able to help with this. It looks like that event fires every time the data is drawn or re-drawn to the DOM, which is pretty much what I'm looking for.

Specifically, I'm looking for a way to apply custom CSS to individual cells in the grid in such a way that would be pretty hard to do via Kendo templates. This seems like the best way to do it, just re-apply the CSS everytime the data is drawn

Thanks,
Mike
0
Dimiter Madjarov
Telerik team
answered on 22 Aug 2014, 08:23 AM
Hi Michael,


Indeed this is the correct approach in the current case. Let us know if you experience any difficulties.

Regards,
Dimiter Madjarov
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
J
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 1
Rolando Rosales
Top achievements
Rank 1
Basem
Top achievements
Rank 1
James Shelton Agar
Top achievements
Rank 2
Vikas
Top achievements
Rank 1
Michael
Top achievements
Rank 1
Dimiter Madjarov
Telerik team
Share this question
or