Hi,
I have a RadTreeList each node has a sort order that comes from the database, that is relative to the parent. (Sort order is part of the object the RadTreeList is bound to). How can I sort the RadTreeList using this sort order? Simply using an 'ORDER BY' clause on the Database query doesn't work because the sort order isn't universal for the tree it's only relative to it's parent. I want to sort the children of each individual node.
I saw these help article relating to the RadTreeView:
http://www.telerik.com/forums/how-to-sort-child-nodes-of-a-node
&
http://www.telerik.com/support/kb/aspnet-ajax/details/sorting-treenodes
Does it work similarly for the RadTreeList - can I write a compare class that compares the sort order of the two given TreeListDataItems and it will work? (Hasn't so far for me, but I could be missing something). Is there any way to implement this simply by manipulating the entries for the ParentDataKeyNames/DataKeyNames or adding multiple entries? I tried making the DataKeyNames Sort Order, but that fails to bind.
I basically just want to use the Sort Order to sort all child nodes of each particular node, instead of just sorting by DataKeyName (AttributeId in this case).
Thanks much,
Craig
If it helps here is the RadTreeList in question.
<
telerik:RadTreeList
ID
=
"rtlCopsAttributes"
runat
=
"server"
OnNeedDataSource
=
"rtlCopsAttributes_NeedDataSource"
AutoGenerateColumns
=
"false"
ParentDataKeyNames
=
"ParentId"
DataKeyNames
=
"AttributeId"
AllowMultiItemSelection
=
"true"
AllowPaging
=
"false"
AllowSorting
=
"false"
OnItemDataBound
=
"rtlCopsAttributes_ItemDataBound"
Height
=
"800px"
Width
=
"500px"
AllowRecursiveSelection
=
"true"
AllowRecursiveDelete
=
"true"
>
<
Columns
>
<
telerik:TreeListBoundColumn
DataField
=
"AttributeId"
UniqueName
=
"AttributeId"
HeaderText
=
"Id"
Display
=
"false"
/>
<
telerik:TreeListBoundColumn
DataField
=
"SortOrder"
UniqueName
=
"SortOrder"
HeaderText
=
"Sort Order"
Display
=
"false"
/>
<
telerik:TreeListBoundColumn
DataField
=
"Description"
UniqueName
=
"Description"
HeaderText
=
"Description"
Display
=
"false"
/>
<
telerik:TreeListBoundColumn
DataField
=
"ParentName"
UniqueName
=
"ParentName"
HeaderText
=
"Parent Name"
Display
=
"false"
/>
<
telerik:TreeListCheckBoxColumn
DataField
=
"HasChildren"
UniqueName
=
"HasChildren"
HeaderText
=
"Has Children"
Display
=
"false"
/>
<
telerik:TreeListCheckBoxColumn
DataField
=
"IsRequired"
UniqueName
=
"IsRequired"
HeaderText
=
"Is Required"
Display
=
"false"
/>
<
telerik:TreeListBoundColumn
DataField
=
"ParentId"
UniqueName
=
"ParentId"
HeaderText
=
"Parent Id"
Display
=
"false"
/>
<
telerik:TreeListBoundColumn
DataField
=
"Name"
UniqueName
=
"AttributeName"
HeaderText
=
"Name"
/>
<
telerik:TreeListCheckBoxColumn
DataField
=
"IsDefault"
UniqueName
=
"IsDefault"
HeaderText
=
"Default"
HeaderStyle-Width
=
"50px"
ItemStyle-Width
=
"50px"
/>
<
telerik:TreeListTemplateColumn
HeaderText
=
"Include"
HeaderStyle-Width
=
"50px"
ItemStyle-Width
=
"50px"
>
<
ItemTemplate
>
<
asp:CheckBox
ID
=
"cboxExplicitInclude"
runat
=
"server"
AutoPostBack
=
"true"
OnCheckedChanged
=
"cboxExplicitInclude_CheckedChanged"
/>
</
ItemTemplate
>
</
telerik:TreeListTemplateColumn
>
<
telerik:TreeListTemplateColumn
HeaderText
=
"Exclude"
HeaderStyle-Width
=
"50px"
ItemStyle-Width
=
"50px"
>
<
ItemTemplate
>
<
asp:CheckBox
ID
=
"cboxExplicitExclude"
runat
=
"server"
AutoPostBack
=
"true"
OnCheckedChanged
=
"cboxExplicitExclude_CheckedChanged"
/>
</
ItemTemplate
>
</
telerik:TreeListTemplateColumn
>
</
Columns
>
<
ClientSettings
>
<
Scrolling
AllowScroll
=
"true"
UseStaticHeaders
=
"true"
SaveScrollPosition
=
"true"
ScrollHeight
=
"520px"
/>
</
ClientSettings
>
</
telerik:RadTreeList
>