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

Sort by ItemsSource order while filter is active

6 Answers 49 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Arthur
Top achievements
Rank 1
Arthur asked on 04 Dec 2014, 11:30 AM
Hi,

I have a problem with filtering here: When I set a filter descriptor, newly added rows are always inserted at the end, as long as filtering is active.
I read somewhere that filtered data is unsorted as long as there is no explicit sorting set. Is this true?

When yes: What is the best way to sort by ItemsSource order? Our customers would expect to see the rows in the same order as when no filter is set.

I would like to avoid an index in my viewmodel, because most grid operations would trigger an O(n) index update loop to update the indices.
Is there a better way?

6 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 05 Dec 2014, 03:05 PM
Hello,

Actually, all the newly added items will be inserted at the end of the Items list and this is not dependent on whether there is filtering applied or not. The filtering is indeed not sorted, you can find all the filtered items available in the RadGridView.Items collection.

May I ask you to share some more information on how do you insert new items? When saying you would like to sort by ItemsSource order, do you mean to have the same order of items as in the original bound source collection?  

Regards,
Dimitrina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Arthur
Top achievements
Rank 1
answered on 10 Dec 2014, 04:37 PM
Hi,

ok, lets describe it less abstractly:

I have the following rows in my grid and operations like move row up/down.

A1
B
A2

If no filtering is active the rows are moved as expected. Now assume that B is filtered away and A1 is moved down.
Now I get:

A2
A1

If the filter is cleared, I get the right order:

B
A1
A2

So while filtering, the order is wrong. It is not the order from my ItemsSource collection.
0
Arthur
Top achievements
Rank 1
answered on 10 Dec 2014, 04:43 PM
ItemsSource is bound source collection for me, yes.
0
Dimitrina
Telerik team
answered on 11 Dec 2014, 11:37 AM
Hello,

As it turns out I cannot guess what the reason for this sorting order is.
Would you please try to isolate it in a demo project and send it back to me? You can also refer to the following blog post on how to isolate a problem.
You can open a new support ticket and attach it there. That way I will check it locally and advise further. 

Regards,
Dimitrina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Arthur
Top achievements
Rank 1
answered on 11 Dec 2014, 01:13 PM
Hi,

isolated project has been sent with ticket 888237.
0
Dimitrina
Telerik team
answered on 11 Dec 2014, 04:16 PM
Hello,

Thank you. I will investigate the case further and reply in the referenced ticket.

Regards,
Dimitrina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
GridView
Asked by
Arthur
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Arthur
Top achievements
Rank 1
Share this question
or