Category / Section
How to clear the row selection in TreeGrid
1 min read
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.
<div id="TreeGridContainer" style="height:350px;width:100%;"></div> <input id="numeric" style="float:left;" type="text" /> <button onclick="unSelect()" style="height:24px">Clear Selection</button> <script type="text/javascript"> $("#TreeGridContainer").ejTreeGrid({ dataSource: sampleData, allowSelection: true, selectionSettings: { selectionType: ej.TreeGrid.SelectionType.Multiple, selectionMode: ej.TreeGrid.SelectionMode.Row, }, //… }) function unSelect() { var treeObject = $("#TreeGridContainer").data("ejTreeGrid"), textBoxObject = $("#numeric").data("ejNumericTextbox"); if (!ej.isNullOrUndefined(textBoxObject.model.value)) treeObject.clearSelection(textBoxObject.model.value); else treeObject.clearSelection(); } </script>
Sample
Please refer the following link for more information about this Sample