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

Indent not showing in TreeListview

6 Answers 43 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Jack
Top achievements
Rank 1
Jack asked on 15 Dec 2011, 03:49 PM
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.

6 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 16 Dec 2011, 10:28 AM
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 >>

0
Jack
Top achievements
Rank 1
answered on 16 Dec 2011, 02:53 PM
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
0
Vlad
Telerik team
answered on 16 Dec 2011, 02:57 PM
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 >>

0
Jack
Top achievements
Rank 1
answered on 16 Dec 2011, 08:36 PM
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
0
Vlad
Telerik team
answered on 19 Dec 2011, 07:52 AM
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 >>

0
Jack
Top achievements
Rank 1
answered on 19 Dec 2011, 03:51 PM
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!
Tags
TreeListView
Asked by
Jack
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Jack
Top achievements
Rank 1
Share this question
or