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

2 posts, 0 answers
  1. Craig
    Craig avatar
    10 posts
    Member since:
    Jan 2015

    Posted 20 Jan Link to this post

    Hi, 

    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? 

     

    Thanks,

    Craig

     

    <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">
     
    <Columns>
      <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>
    </Columns>
    <ClientSettings>
       <Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="true" ScrollHeight="520px" />
     
    </ClientSettings>
    </telerik:RadTreeList>

     

  2. Kostadin
    Admin
    Kostadin avatar
    1713 posts

    Posted 25 Jan Link to this post

    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) {
                a.toggleExpandCollapse()
            })
        }
    </script>

    Regards,
    Kostadin
    Telerik
    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top