Hello,
I have implemented RadTreeList client side selection functionality, which does as follows:
1. When i select Parent, it select all child.
2. When I deselect Parent, it deselect all child.
3. When I deselect child, No effect occurs. All selection remains as it is except current selection.
4. When I select the child, It should select parent item of that child not all child.
Now I using this script I can get first 3 rules but cannot get 4th one.
Here I have created Script as bellow:
Script:
RadTreeList HTML:
I have implemented RadTreeList client side selection functionality, which does as follows:
1. When i select Parent, it select all child.
2. When I deselect Parent, it deselect all child.
3. When I deselect child, No effect occurs. All selection remains as it is except current selection.
4. When I select the child, It should select parent item of that child not all child.
Now I using this script I can get first 3 rules but cannot get 4th one.
Here I have created Script as bellow:
Script:
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> <script type="text/javascript"> function OnClientNodeClicked(sender, args) { var currNode = args.get_item(); var childNodes = currNode.get_childItems(); var nodeCount = currNode.get_childItems().length; if (nodeCount > 0) { var isChecked = currNode.get_selected(); UpdateAllChildren(currNode, childNodes, nodeCount, isChecked); } } function UpdateAllChildren(currNode, nodes, nodecount, checked) { var i; for (i = 0; i < nodecount; i++) { if (checked) { nodes[i].set_selected(true); } else { nodes[i].set_selected(false); } } } </script></telerik:RadCodeBlock>RadTreeList HTML:
<telerik:RadTreeList ID="rtlBusinessUnit" runat="server" DataKeyNames="Business_Unit_ID" ClientSettings-AllowPostBackOnItemClick="false" OnNeedDataSource="rtlBusinessUnit_OnNeedDataSource" ParentDataKeyNames="ParentBUID" OnItemCreated="rtlBusinessUnit_OnItemCreated" OnItemDataBound="rtlBusinessUnit_OnItemDataBound" AutoGenerateColumns="false" AllowMultiItemSelection="true"> <Columns> <telerik:TreeListSelectColumn HeaderStyle-Width="38px" UniqueName="BussinessUnitCheckboxes"> </telerik:TreeListSelectColumn> <telerik:TreeListBoundColumn DataField="Business_Unit_ID" HeaderText="Business_Unit_ID" Visible="false" UniqueName="Business_Unit_ID" /> <telerik:TreeListBoundColumn DataField="LegalName" HeaderText="Name" UniqueName="LegalName" /> <telerik:TreeListBoundColumn DataField="Business_Unit_ID" HeaderText="Business_Unit_ID" Visible="false" UniqueName="Business_Unit_ID" HeaderStyle-Width="80px" /> </Columns> <ClientSettings> <ClientEvents OnItemSelected="OnClientNodeClicked" OnItemDeselected="OnClientNodeClicked" /> <Selecting AllowItemSelection="true" /> <Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="true" ScrollHeight="300" /> </ClientSettings> </telerik:RadTreeList>