Last Updated: 21 Jan 2015 09:46 by ADMIN
Created on: 25 Jul 2014 22:31
Category: TreeList
Type: Bug Report
RadTreeList Expand/Collapse does not work properly when AllowLoadOnDemand is true and DataKeyNames contains more than one field
This error occurs using version 2013.2.717.45 of Telerik.Web.UI.dll

We are using a RadTreeList to display data with a three-part key.  The control was set up with AllowLoadOnDemand="true", DataKeyNames="Key1,Key2,Key3", and ParentDataKeyNames="ParentKey1,ParentKey2,ParentKey3", and both the NeedDataSource and ChildItemsDataBind events were handled properly on the server side.  Clicking the expand/collapse buttons resulted in erratic behavior -- sometimes, all nodes on a given level would be expanded or collapsed at once, sometimes, the entire tree would collapse and not be able to be expanded again, and occasionally the desired node would expand or collapse as desired.

I tracked the problem (using JustDecompile) to a bug in TreeListLoadOnDemandContext.ItemNeedsToBeExpanded.  The same bug appears to be in ItemNeedsToBeSelected, RemoveExpandedDataKeyValue, and RemoveSelectedDataKeyValue as well.  In all four cases, the code loops through the data keys comparing one to the next -- but overwrites its flag on each iteration.  In other words, it doesn't check if ALL keys are equal, only if the last one compared is equal.

I added "Key" and "ParentKey" fields to the data object that combined all three fields into a single struct, so that the control now has DataKeyNames="Key" and ParentDataKeyNames="Parent", and it now works properly.
1 comment
Posted on: 21 Jan 2015 09:46
 I will encourage you to open a regular support ticket. Providing a small runnable project will help us further elaborate the issue and get back to you with more straight to the point answers.