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

When ExpandCollapseMode="Client" treelist always default loads fully collapsed

1 Answer 246 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 2
Craig asked on 20 Jan 2016, 04:54 PM


On a RadTreeList I would like to set ExpandCollapseMode="Client", so that all the expand/collapse is left to the client side, as this improves UX for my application. However, I have noticed that by setting this attribute on the RadTreeList definition, every time my RadTreeList loads (on page load) it is fully collapsed. (See attached image). Even if the last call I make server side is rtlTreeList.ExapandAllItems(); 

 I assume that on the client side, the nodes are being collapsed by default - is there any way to alter this behaviour? When my RadTreeList loads, it is also disabled, to allow read only access, which is why I would like the tree to load fully expanded.  Or perhaps there is a better way to make a RadTreeList disabled, but viewable other then setting each node to disabled? 





<telerik:RadTreeList ID="rtlAreaJurTreeList" runat="server" OnNeedDataSource="rtlAreaJurTreeList_NeedDataSource"
ParentDataKeyNames="ParentAreaCode" DataKeyNames="Code" AllowPaging="false"
AutoGenerateColumns="false" AllowSorting="true" OnItemDataBound="rtlAreaJurTreeList_ItemDataBound" Height="550px"
HeaderStyle-BorderStyle="Solid" AllowRecursiveSelection="true"
AllowRecursiveDelete="true" Width="400px" ExpandCollapseMode="Client">
  <telerik:TreeListBoundColumn DataField="ParentAreaCode" UniqueName="ParentAreaCode" HeaderText="Parent Area Code" Display="false" />
  <telerik:TreeListBoundColumn DataField="Code" UniqueName="Code" HeaderText="Area/Jur Code" Display="false" />
  <telerik:TreeListBoundColumn DataField="Area" UniqueName="Area" HeaderText="Area Name (If Area)" Display="false" />
  <telerik:TreeListBoundColumn DataField="Jurisdiction" UniqueName="Jurisdiction" HeaderText="Jurisdiction Name (If Jur)" Display="false" />
  <telerik:TreeListBoundColumn DataField="isAreaItem" UniqueName="isAreaItem" HeaderText="isAreaItem" Display="false" />
  <telerik:TreeListBoundColumn DataField="isJurisdictionItem" UniqueName="isJurisdictionItem" HeaderText="isJurisdictionItem" Display="false" />
  <telerik:TreeListBoundColumn DataField="Description" UniqueName="Description" HeaderText="Description" />
  <telerik:TreeListSelectColumn UniqueName="Included" HeaderStyle-Width="50px" HeaderText="Included"></telerik:TreeListSelectColumn>
   <Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="true" ScrollHeight="520px" />


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 25 Jan 2016, 11:23 AM
Hello Craig,

I am afraid I was unable to understand your requirement about the read only items. Note that the TreeList by default is shown in a read only mode and you need to enable the editing if you want to modify its data.If you are using a Client expand mode then you need to expand/collapse the items on the client. A possible solution to do that is to loop through all items on pageLoad event and call toggleExpandCollapse() method for each one of them. Please check out the following code snippet.
<script type="text/javascript">
    function pageLoad() {
        var treeList = $find("<%= rtlAreaJurTreeList.ClientID %>");
        treeList.get_dataItems().forEach(function (a) {

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Asked by
Top achievements
Rank 2
Answers by
Telerik team
Share this question