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

[Solved] Finding Nodes by Attribute AND Value

1 Answer 150 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Michael Love
Top achievements
Rank 1
Michael Love asked on 02 Mar 2010, 11:05 PM
Hi there.

I have a tree view where the basic heirarchy is such:

Location
    Company
        Employee

The value for each of these nodes is a numeric id. My issue is that the Node values can be the same for the nodes at different levels of the tree. For example, the node value for Location X could be 23 AND the Node value for Employee 127 could be 23.

So, my problem is that the Find methods (FindByValue in this case) doesn't always find the correct node. I did add and Attribute to each node that defines the node level as defined by my below enum:

 

public enum ReportTreeNodeType

 

 

{

Location,

Company,

Employee

}



So, what I really need do do is find by both a value and an attribute. Ideas on how to best solve this issue without iterating through each node?

Thanks, Mike

Correction - I am saving the Node type in the DataItem of the node and not the Attribute.

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 08 Mar 2010, 03:59 PM
Hi Michael,

I would add a custom attribute that is a concatenated string of the Value and Location attribute. For example, I would create a custom attribute called UniqueValue and set it to 'Location23' or 'Employee127'. Then I can use the findNodeByAttribute method of the treeview client object. Let me know if for some reason you cannot use this suggestion.


Kind regards,
Peter
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
TreeView
Asked by
Michael Love
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or