View previous topic :: View next topic |
Author |
Message |
Happs
Joined: 13 Jul 2011 Posts: 62 Location: Sydney, Australia
|
Posted: Thu Feb 09, 2012 6:25 am Post subject: Load limited items to display around the selected item |
|
|
Hi,
I am using virtual tree view to display large number of items.
My custom datasource class implements the IList interface and Count, Item, IndexOf() properties.
All working fine, I can see virtual tree loads on demand as scroll down.
Now I need to select an item in virtual tree, immediately after setting the datasource. For example, I need to select item number '7000' in the list.
I can do this by setting the 'SelectedItem' property, it works but I see delay loading items in virtual tree. I can see virtual tree loads all items from 1 to 7000.
Is my observation correct?
Is it possible to load just the numbers of items we need to display around the selected result? As user scroll up/down from item 7000, it will load more items.
I am using version 4.1.1.0.
Thanks. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu Feb 09, 2012 11:06 am Post subject: |
|
|
I don't think that is correct. Setting the SelectedItem causes VirtualTree to call IList.IndexOf to get the index of the given object in the list. Virtual Tree will then scroll to that location loading only those items required to display the page around that item. How have you implemented IList.IndexOf() ? If you are just looping through the elements looking for the item then you will of course end up loading all the previous elements. _________________ Infralution Support |
|
Back to top |
|
|
Happs
Joined: 13 Jul 2011 Posts: 62 Location: Sydney, Australia
|
Posted: Sat Feb 11, 2012 12:41 am Post subject: |
|
|
Thanks for your comments.
Quote: | How have you implemented IList.IndexOf() |
You are correct, I am iterating through items in list to find the item which matches condition, which lets the virtual tree to load previous items and few next items to show in tree.
In my IList, I have also implemented "this[int index]", where item get loaded on demand from database when virtual tree request.
Need to re-think about the approach. |
|
Back to top |
|
|
|