How to clear the row selection in TreeGrid?
In JavaScript 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
Conclusion
I hope you enjoyed learning about how to clear the row selection in TreeGrid.
You can refer to our JavaScript TreeGrid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our JavaScript TreeGrid example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!