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

Multi-column Treeview

8 Answers 234 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Levi
Top achievements
Rank 1
Levi asked on 16 Jul 2008, 02:45 AM
I was wondering if there is a way to do a 2 column treeview? My treeview is simple, but I'm using two columns to save space. Only way I can think to do it is to deselect all nodes from the adjacent treeview each time a node is selected? Any ideas on the best way to implement something like this?

Great product by the way. Simply awesome. The skins, performance, everything, is the best around.

Thanks,
Levi

8 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 18 Jul 2008, 12:11 PM
Hello Levi,

Indeed, I am not quite sure what do you mean by "two column treeview".
Have you checked the Templates section in our:
I hope this will get you started.

All the best,
Veskoni
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
alicia@afm
Top achievements
Rank 1
answered on 19 May 2009, 09:34 PM
Hello,

I too need a 'multicolumn tree view' - something similar to this: 
http://extjs.com/deploy/dev/examples/tree/column-tree.html

What I need to implement is a sleek UI for assigning access rights.
On the left side I will have a simple Tree with Roles / Users;

On the right side I need a multi-column TreeView with a few columns:
  • one column with the actual Tree: the resources to be accessed (categories and subcategories)
  • multiple columns with check boxes for each access right

Do you have any suggestions on how I could implement such a Tree View?

Thanks!
Alicia

0
Jay O'Brien
Top achievements
Rank 1
answered on 03 Jun 2009, 01:38 AM
Does anyone know if a multicolumn tree control is possible (easily) in Telerik? Another example of the kind I want to build in Telerik is at http://demos.devexpress.com/ASPxTreeListDemos/Appearance/GridLinesTreeLines.aspx

Thanks!
Jay (happy Telerik customer)
0
alicia@afm
Top achievements
Rank 1
answered on 03 Jun 2009, 02:18 AM
Actually I forgot to post my findings - you can do it using the NodeTemplate. It will probably take a bit of work to align things properly (I haven't spend any time aligning children columns to parents yet), but to actually build and bind the 'extra' controls in  a NodeTemplate is really easy (as you can see from the picture bellow). 

The code for NodeTemplate goes along these lines:

 

<telerik:RadTreeView ID="tv" runat="server" CheckBoxes="false" OnNodeDataBound="tv_NodeDataBound" OnDataBinding="tv_DataBinding" >

 

 

<DataBindings>

 

 

<telerik:RadTreeNodeBinding/>

 

 

</DataBindings>

 

 

<NodeTemplate>

 

 

<table width="500px" cellpadding="0" cellspacing="0" border="0">

 

 

<tr>

 

 

<td><%# DataBinder.Eval(Container, "Text") %></td>

 

 

<td width="40px"><asp:CheckBox ID="chkDeny" runat="server" OnCheckedChanged="chkDeny_CheckedChanged" AutoPostBack="true" /> </td>

 

 

<td width="40px"><asp:CheckBox ID="chkView" runat="server" OnCheckedChanged="chkView_CheckedChanged" AutoPostBack="true" /> </td>

 

 

<td width="40px"><asp:CheckBox ID="chkCreate" runat="server" OnCheckedChanged="chkCreate_CheckedChanged" AutoPostBack="true" /> </td>

 

 

<td width="40px"><asp:CheckBox ID="chkUpdate" runat="server" OnCheckedChanged="chkUpdate_CheckedChanged" AutoPostBack="true" /></td>

 

 

<td width="40px"><asp:CheckBox ID="chkDelete" runat="server" OnCheckedChanged="chkDelete_CheckedChanged" AutoPostBack="true" /></td>

 

 

</tr>

 

 

</table>

 

 

</NodeTemplate>

 

 

</telerik:RadTreeView>

 

 

 

As I load my data from an XML, binding the CheckBox state goes something like this:

CheckBox deny = (CheckBox)currentTreeNode.FindControl("chkDeny");

 

 

if (deny != null)

 

{

 

    XmlAttribute attr = node.Attributes["IsDenied"];

 

    deny.Checked = (attr !=

null && attr.Value == "1");

 

}

 




Hope it helps,

Alicia
0
Levi
Top achievements
Rank 1
answered on 03 Jun 2009, 02:21 AM
The DevExpress example is exactly what I was referring to. Nesting messy grids simply does not work as well when trying to display hierarchical data in a clean fashion. There really should be an easy way to do something similar to the example posted earlier below.
http://demos.devexpress.com/ASPxTreeListDemos/Appearance/GridLinesTreeLines.aspx

This addition would be great to the already awesome Telerik libraries.

Levi


0
Jay O'Brien
Top achievements
Rank 1
answered on 03 Jun 2009, 02:22 AM
Thanks, that makes sense.

I think you are right - aligning things properly will be very hard ... probably VERY hard (I cant see your uploaded image).

Thanks,
Jay
0
alicia@afm
Top achievements
Rank 1
answered on 03 Jun 2009, 02:25 AM
And I couldn't agree more with Levi's comments - yes, I believe adding such a feature to telerik TreeView control would be a wonderful idea :)

Alicia
0
Naresh
Top achievements
Rank 1
answered on 29 Jun 2009, 06:11 AM
Did you get the alignment right?, struggling to get the alignment right, and i couldn't get it.
Tags
TreeView
Asked by
Levi
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
alicia@afm
Top achievements
Rank 1
Jay O'Brien
Top achievements
Rank 1
Levi
Top achievements
Rank 1
Naresh
Top achievements
Rank 1
Share this question
or