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

Cannot select item when existing in several places

1 Answer 27 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Marek
Top achievements
Rank 1
Marek asked on 03 Mar 2017, 10:32 AM

I have a problem with RadTreeView control. I have a collection like this:

foo

..|-bar

..|-amazing

....|-bar

Element 'bar' have two parents: 'foo' and 'amazing'. When I put collection like this to RadTreeView control and click first 'bar' it select it's every occurrence in control. I need to know exact path of selected element (is it from 'foo' or from 'amazing') and I can't create new elements based on that collection (to be unique) - it have to be this collection. I can only add some new properties in elements.

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 07 Mar 2017, 03:16 PM
Hi Marek,

Thank you for contacting us.

You have hit a limitation of the RadTreeView control when you don't have unique objects in your bound collection. Basically, when you have 1 single object mapped to different containers you can expect many unexpected results when scrolling/selection/ expanding thousands of items. That is why we highly encourage you to bind the RadTreeView to a collection of unique ViewModels. In a scenario where you can't do that ( as is your case), you can consider wrapping the DataItem class in a new class - DataItemWrapper. This way different DataItemWrapper objects can hold equal DataItem objects. 

Regards,
Dinko
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.
Tags
TreeView
Asked by
Marek
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or