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 

Filtered items view

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



Joined: 27 May 2011
Posts: 20

PostPosted: Fri Mar 15, 2013 6:14 am    Post subject: Filtered items view Reply with quote

We are using the Infralution Virtual Tree to display a large number of items and our data-source class implements the IList interface. We wish to add a feature which allows the user to enter text which is compared with item nodes and renders a filtered, hierarchical item view.

An example of our tree view:

Code:
- Contacts:
  * Tony Abbott
  * Julia Gillard
  * Kevid Rudd 
  * Bill Smith
  ... (many more)
- Discussions:
  * Mining tax
  * Media reforms
  * Education reforms
  ... (many more)


We would like to find items easily from the list above and are considering the two approaches outlined below.


1. Once the user enters the search text, the tree view displays only the filtered items, maintaining parent-child relationship.

Example: Search text "reforms"

Tree view could show matches:

Code:
- Discussions:
  * Media reforms
  * Education reforms


This is our preferred approach. Is it possible to filter the nodes displayed in the tree? If so, it would be most appreciated if you would share an outline of a technique that would fit our IList implementation.


2. The following is an alternative but not our preferred approach because it does not provide a filtered, hierarchical item view. Once the user enters the search text, locate matching items in the tree view and select the first item. We could have find next and previous buttons which basically finds & selects the next or previous matching item.

Below is a working technique for finding nodes in the tree. Can you suggest how the technique might be improved?

Code:
- Find the item in IList.
- Once the item is found, call virtual tree FindRow(node) to get the Row.
  * If row not expanded, then expand it.
    row.Expanded = true;
  * Set the virtual tree selected row and set focus.
    virtualTree.SelectedRow = row;
    virtualTree.Focus();



Do you see any pros & cons of each approach listed above? Is there any other technique you would recommend?

Thank you for your advice.

Greg
Advansys
Back to top
View user's profile Send private message Visit poster's website
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Fri Mar 15, 2013 7:34 am    Post subject: Reply with quote

Virtual Tree does not provide any way of hiding tree rows - because to do so would compromise performance when dealing with large data sources which is the main objective of Virtual Tree. Also filtering can often most efficiently done by the data source - for instance leverage database filtering. If you wish to implement filtering then you need to do this by changing the data returned by your data source IList implementations. So your UI code would set a property on the data source which indicates the filtering condition and your data source IList implementation would return a count of the items that meet that criteria. If your datasources don't implement IBindingList change notifications then after changing the filtering condition you would need to manually refresh the data displayed in the tree by calling VirtualTree.UpdateRows(). This forces the tree to reget all its data.

Your second option would also work and I can't see any major issue with your proposed implementation.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Advansys



Joined: 27 May 2011
Posts: 20

PostPosted: Mon Mar 18, 2013 1:11 am    Post subject: Reply with quote

Thank you for your quick reply and suggestion, much appreciated.

Greg
Advansys
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 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