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 

Programmatic Data Binding - Large Data Sets

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



Joined: 07 Dec 2007
Posts: 1

PostPosted: Wed Jan 23, 2008 10:47 am    Post subject: Programmatic Data Binding - Large Data Sets Reply with quote

First let me say that I think VirtualTree (VT) is a fantastic component.

I'm currently using VT to display a hierarchal structure consisting of aprox 50 nodes at the top level, each of which may have up to 4 million child items.
I’ve got a prototype working quite nicely with VT3.8 using programmatic data binding.
Something about VT irritates me though:
GetChildren(..) requires me to supply all the child items in one go – even if parent node is not expanded (and may never even get expanded by the user).
I my case – displaying the initial tree with all nodes collapsed at level one causes 50 calls to GetChildren(..) each of which requires me to allocate a large array – and populate in with data from the Data Tier.
In my mind VT should start off by calling something like GetChildCounts(int[] parentRowIDs). This would allow it to determine whether the node should be expandable or not without moving/allocating large amounts of data. Then VT could call GetChildren() just before a node actually gets expanded – this would be a great improvement.
An even better improvement would be to drop GetChildren() all together and simply utilize row.ChildIndex in subsequent calls to GetRowData(..) to fetch the required data for that particular row. This way we’re sure that the data is actually going to be used and displayed.
In fact if VT knows which child rows it intends to display then the event should fetch all the data in one call passing an array of GetChildrenEventArgs i.e.:
Code:
GetRowData(object sender, GetChildrenEventArgs[] eventArgs)


I guess my question is why VT needs to know all children up front? Is it to enable sorting? For large data sets sorting is best implemented in the data tier.
Please put me right if I’m misunderstanding something here.
/Klaus
_________________
/KBJensen
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Wed Jan 23, 2008 10:43 pm    Post subject: Reply with quote

Thanks for your feedback. To prevent GetChildren being called for every row you can handle the GetChildPolicy event and set the ChildPolicy to LoadOnExpand. GetChildren will then be called the first time that the user expands the row. This does mean however that if the row has no children that the expansion indicator will be present initially (and disappears when the user clicks it)

The reason that VirtualTree uses the IList interface rather than requesting the child count and then row data individually as you suggest is that this allows it to implement automatic change notification handling through the IBindingList interface (ie when an item in the list changes VirtualTree is automatically notified and updates). Binding to the IList/IBindingList interfaces also makes it much easier to bind to most standard .NET collections.

An alternative to setting the ChildPolicy to LoadOnExpand is to create your own data class that implements the IList interface and loads your underlying data on demand. This is good solution if you are loading your data from disk and want to implement a loading/caching mechanism that means you don't have to hold the entire list in memory. This is how Infralution's Virtual Data Objects works for example. This essentially allows youi to do exactly what you requested. You can implement the IList.Count so it returns the number of items but then only load the items when an item is requested through IList.Item
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Feature Requests 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