How to clear the row selection in TreeGrid?
In TreeGrid, by using “clearSelection” public method we can unselect all the selected rows or any specific row. To clear the specific row, we need to pass the index value as argument in “clearSelection” method. When we call this method without any argument it clears all the selected rows. The following code snippet explains how to unselect the row dynamically.
<body>
<form id="form1" runat="server">
<div>
<ej:TreeGrid runat="server" ID="Container" ChildMapping="Children" AllowSelection="true">
<SelectionSettings SelectionMode="Row" SelectionType="Multiple" />
</ej:TreeGrid>
</div>
<div style="float: left;padding-right:10px">
<ej:NumericTextBox ID="numeric" runat="server" Value="" MinValue="0" MaxValue="14" Height="35" Width="100px" DecimalPlaces="0" />
</div>
<div>
<ej:Button Type="Button" CssClass="e-btn" ClientSideOnClick="unSelect" Height="35" runat="server" Text="Clear Selection">
</ej:Button>
</div>
</form>
<script type="text/javascript">
function unSelect() {
var treeObject = $("#Container").data("ejTreeGrid"),
textBoxObject = $("#numeric").data("ejNumericTextbox");
if (!ej.isNullOrUndefined(textBoxObject.model.value))
treeObject.clearSelection(textBoxObject.model.value);
else
treeObject.clearSelection();
}
</script>
</body>
Sample
Please refer the following link for more information about this Sample