View previous topic :: View next topic |
Author |
Message |
Happs
Joined: 13 Jul 2011 Posts: 62 Location: Sydney, Australia
|
Posted: Sat Mar 17, 2012 1:01 am Post subject: Sorting IList on demand |
|
|
I have created a control that inherits from VirtualTree, datasource implements IList interface, virtual tree loads on demand as scroll down.
I need to implement column sort and need your advice/confirmation about best approach.
I had a look at the FileBrowser example where I can see the example override OnGetRowData & GetChildrenForRow.
Do I need to do same or any other approch you recommend?
I would prefer to sort visible items on virtual tree as it can have thousands of items displayed. Just to give you an example:
Virtual tree load 100 items, when 'Name' column clicked, I would like to sort 100 items by name. User can scroll down to load more items, I would like to load new items and sort accordingly.
Thank you. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Tue Mar 20, 2012 2:35 am Post subject: |
|
|
Sorting just the displayed items is likely to be highly confusing for the user. I don't know of any other control that works that way. Normally when you sort items you expect it to affect the ordering of all items as you scroll. Say if I'm sorting by name and it shows me 3 items with names starting with "A" then most users would expect that means there are only 3 items in the entire list start with "A". They wouldn't expect to scroll down and suddenly find another 4.
Sorting can be an expensive operation for very large collections. In this case you should probably consider using a database and leveraging the sorting facilities that this provides. Databases are able to provide reasonably efficient sorting mechanism because they maintain indexes that speed this up. _________________ Infralution Support |
|
Back to top |
|
|
Happs
Joined: 13 Jul 2011 Posts: 62 Location: Sydney, Australia
|
Posted: Tue Mar 20, 2012 2:49 am Post subject: |
|
|
Thanks for your response
My initial test also confirm better performance to sort data before displaying to virtual tree. |
|
Back to top |
|
|
|