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

Maintain sorting?

2 Answers 56 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 23 Dec 2008, 03:57 PM
Is there  a way to maintain sorting when the ItemsSource changes?  So that when it's rebound, it stays in the same order that the user chose?

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Hristo Deshev
Telerik team
answered on 29 Dec 2008, 09:49 AM
Hi Scott,

That should be the default behavior. Clicking a column header will ultimately result in a SortDescription being added to the RadGridView control, and that persists across rebinds. I just tried it using both auto- and manually-generated columns (project attached), and the sort descriptions and column sorting states persist as expected.

Do you have a case when that does not happen? Can you provide some details on your scenario?

Sincerely yours,
Hristo Deshev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Scott
Top achievements
Rank 1
answered on 06 Jan 2009, 02:25 PM
Thanks!  It does work like that, I was mistaken.  

Now that I see that working, how can I clear out the SortDescription so sorting is not maintained?  SortDescription is read-only. 


EDIT:  Figured it out.  

SortDescriptions.Clear();

Tags
GridView
Asked by
Scott
Top achievements
Rank 1
Answers by
Hristo Deshev
Telerik team
Scott
Top achievements
Rank 1
Share this question
or