Sort by ItemsSource order while filter is active

7 posts, 0 answers
  1. Arthur
    Arthur avatar
    22 posts
    Member since:
    Jul 2014

    Posted 04 Dec 2014 Link to this post

    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?
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 05 Dec 2014 Link to this post

    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.

     
  3. Arthur
    Arthur avatar
    22 posts
    Member since:
    Jul 2014

    Posted 10 Dec 2014 in reply to Dimitrina Link to this post

    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.
  4. Arthur
    Arthur avatar
    22 posts
    Member since:
    Jul 2014

    Posted 10 Dec 2014 in reply to Arthur Link to this post

    ItemsSource is bound source collection for me, yes.
  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 11 Dec 2014 Link to this post

    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.

     
  6. Arthur
    Arthur avatar
    22 posts
    Member since:
    Jul 2014

    Posted 11 Dec 2014 in reply to Dimitrina Link to this post

    Hi,

    isolated project has been sent with ticket 888237.
  7. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 11 Dec 2014 Link to this post

    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.

     
Back to Top