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

Client-side Sort

5 Answers 82 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Viz
Top achievements
Rank 1
Viz asked on 05 Apr 2011, 12:02 AM
Hi All,

I'm binding my grid with the client-side api.  My data gets populated but by default displays with my ID field in ASC order.  I'd like change this and have it appear in DESC order.  I cannot change the query from the datasource.  I've tried playing around with the mastertableview's fireCommand "sort" but it creates an undesired postback.  There must be a way to do sort on a field right after the initial load.

Thx in advance. 

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 05 Apr 2011, 06:21 AM
Hello John,


I hope the following video is enough to accomplish client side sorting for radgrid.
RadGrid for ASP.NET AJAX - Client-Side Sorting


Regards,
Princy.
0
Viz
Top achievements
Rank 1
answered on 05 Apr 2011, 07:16 AM
Thanks for the link Princy.  It is unclear to me from the video if the handling requires me to change my webservice method "ORDER BY" statement.  Unfortunately I can't change that.  If I get my data from a web service do I need to call the PageMethod as shown in video. 

Thanks.
0
Tsvetina
Telerik team
answered on 08 Apr 2011, 09:39 AM
Hi Viz,

When you use WebService binding I assume the methods inside it return collections of data. If you do not want to get the collection already sorted from the datasource, you could try sorting it afterwards, when it is populated, just before returning it from the method. Is this not an option in your scenario?

Best wishes,
Tsvetina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
HL
Top achievements
Rank 1
answered on 05 Jul 2011, 11:05 PM
hi all:
    my project doesn't use web service to get data. it means I can't use Pagemethods to call the code behind method. is it any way for RadGrid to sort on client side only and also bind data on the client side for the application which doesn't use web services

It should be ok for me to bind data on the server side. I just want to sort data on the client side without posting back to the server. I checked the demo for bind data on the client sides. they use the web services and won't work for my project

Thanks for any help
Helena
0
Tsvetina
Telerik team
answered on 08 Jul 2011, 02:18 PM
Hello Helena,

You can either use Page Methods ( without using a Web service ) for client binding, or use AJAX to improve the user experience when posting back to the server on sort. However, you cannot sort a server bound grid on the client-side.

The following demo binds on the client without the use of Web Services:
Programmatic Binding

Best wishes,
Tsvetina
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Grid
Asked by
Viz
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Viz
Top achievements
Rank 1
Tsvetina
Telerik team
HL
Top achievements
Rank 1
Share this question
or