Indent not showing in TreeListview

7 posts, 0 answers
  1. Jack
    Jack avatar
    14 posts
    Member since:
    Sep 2011

    Posted 15 Dec 2011 Link to this post

    Hi, I'm building a TreeListView with self-referencing data.

    Each Item has an ID and a ParentID, and the hierachy of the data relies on that.

    I can get most things to work, but however I cannot see the indentation when I click to expand something. I have attached an image to show what it looks like.

    I'm not sure if this is due to the way the data source is binded. I'm actually dynamically binding the column (which are dynamically generated) to string indexers of a collection of dictionaries.

    Maybe that broke the indentation of the Tree??

    Or is there a setting somewhere that I can manually set to enable the indentations.

    Any help would be great.

    Thanks in advance.
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 16 Dec 2011 Link to this post

    Hi,

     Can you post more info how the treelist is bound? What is your child table definition? 

    Kind regards,
    Vlad
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Jack
    Jack avatar
    14 posts
    Member since:
    Sep 2011

    Posted 16 Dec 2011 Link to this post

    Hey Vlad,

    Thanks for the response, I just solved the problem.

    Another quick question though, you wrote an article on dynamically creating a table, I can't find the link anymore, but I remember you have DataTable.cs , DataRow.cs, DataColumn.cs.. If I bind the tree to an instance of DataTable, do you think I can expand the DataRow class to have an instance of DataTable (suppose we call it ChildTable = new DataTable() ), and bind child table definition to that, do you think that will work??

    Thanks
  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 16 Dec 2011 Link to this post

    Hi,

     Indeed you can use my lightweight DataTable to bind hierarchical structure to the treelist since the table is not much different compared to the static scenario - will just create class with properties dynamically. 

    Best wishes,
    Vlad
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Jack
    Jack avatar
    14 posts
    Member since:
    Sep 2011

    Posted 16 Dec 2011 Link to this post

    Cool, Thanks so much.

    One last quick question, is it possible to have the hierarchy expanded upon loading?? You know how I click on the Parent and we see the child??

    Is there a property in the TreeListView that allows the Tree to be expanded when loaded? As in we see all the children right away?

    Thanks
  7. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 19 Dec 2011 Link to this post

    Hello,

    You can use ExpandAllHierarchyItems() method to achieve your goal. Please check our "First Look" demo for more info. With our upcoming service pack (this week) you can use the new treelist property AutoExpandItems.

    Kind regards,
    Vlad
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  8. Jack
    Jack avatar
    14 posts
    Member since:
    Sep 2011

    Posted 19 Dec 2011 Link to this post

    Hi, I tried to call the ExpandAllHierarchyItems() method , but I keep getting a nullreference exception. I can't find any documentation on this method. Can you tell me why it would throw this exception?


    Edit: My mistake, this method should be called after TreeList has loaded. I called this method in the RadTreeListView loaded event, and everything works

    Thanks so much for all your help.

    Would be better if there were more detailed documentation for methods and properties of some radcontrols. Thanks!
Back to Top
DevCraft banner