Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Load limited items to display around the selected item

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
Happs



Joined: 13 Jul 2011
Posts: 62
Location: Sydney, Australia

PostPosted: Thu Feb 09, 2012 6:25 am    Post subject: Load limited items to display around the selected item Reply with quote

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
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Thu Feb 09, 2012 11:06 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Happs



Joined: 13 Jul 2011
Posts: 62
Location: Sydney, Australia

PostPosted: Sat Feb 11, 2012 12:41 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group