This is a migrated thread and some comments may be shown as answers.

Treeview node visible or filter

4 Answers 551 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Kim
Top achievements
Rank 1
Kim asked on 19 Dec 2016, 06:36 PM

I would like to hide/unhide nodes based on a bound data source item value.  In my sample project, I can assign a full data source and a filtered data source from 'All Data Source' button click or 'Filtered Data Source' button click. But hide and unhide using the node visible property in radTreeView1_NodeFormatting event triggered from the 'Visible = Primary (Hide)' and 'All Visible Unhide' don't work.  Also, the first click of 'Visible=Primary(Hide)' only formats the first 5 nodes.  It seems once a node's visible property is false, you can not set it to true programmatically.  I do not want to refresh or reload the tree view. 

It would be really great if there was some way to filter tree view based on Tag versus Text property.  Then I could simply populate the tag with true or false and filter.

 

4 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 20 Dec 2016, 08:50 AM
Hello Kim,

Thank you for writing.  

RadTreeView uses virtualization. Its visual node elements are created only for the visible nodes and are being reused during operations like scrolling. That is why if you use the NodeFormatting event to style the visual elements, it is necessary to reset the style for the rest of the nodes in order to avoid incorrect style for unexpected nodes.

As to the filtering, note that RadTreeView supports custom filtering which is a flexible mechanism for filtering RadTreeView nodes by using custom logic. It has a higher priority than the applied FilterDescriptors. Additional information is available in the following help article: http://docs.telerik.com/devtools/winforms/treeview/working-with-nodes/custom-filtering

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Kim
Top achievements
Rank 1
answered on 21 Dec 2016, 04:28 PM

Your example is filtering on text property of node.  I'd like an example filtering on tag property.

Thanks!

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 22 Dec 2016, 12:35 PM
Hello Kim, 

Thank you for writing back. 
 
The referred help article demonstrates a approach how to perform custom filtering in RadTreeView. The FilterPredicate property allows you to determine which nodes to be visible according to custom logic. Indeed, in the it is used the Text property. However, you are free to use the RadTreeNode's Tag or DataBoundItem properties or any other property that is useful for determining whether a node is visible or not.
 
I hope this information helps. If you have any additional questions, please let me know. 

Regards,
Dess
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Kim
Top achievements
Rank 1
answered on 13 Jan 2017, 09:03 PM

Able to filter on underlying data bound item as I needed.  Thanks!

Tags
Treeview
Asked by
Kim
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Kim
Top achievements
Rank 1
Share this question
or