Cannot select item when existing in several places

2 posts, 0 answers
  1. Marek
    Marek avatar
    1 posts
    Member since:
    Mar 2017

    Posted 03 Mar 2017 Link to this post

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





    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.

  2. Dinko
    Dinko avatar
    578 posts

    Posted 07 Mar 2017 Link to this post

    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. 

    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.
Back to Top