Hi Jorge,
In TreeGrid control multiple selection will be done only in the view, the rows or the records are not preserved but we can get the selected rows in TreeGrid using the “RowSelected” client side event.
Code Snippet:
<ej:TreeGrid ID="Treegrid" runat="server" AllowColumnResize="true" RowSelected="rowSelected"> </ej:TreeGrid> <script type="text/javascript"> var selectedRows = [], selectedRecords = []; function rowSelected(args) { var treeObj = $("#Treegrid").data("ejTreeGrid"), selectedRowIndex = treeObj.selectedRowIndex(); selectedRows.push(args.targetRow[0]); selectedRecords.push(treeObj.model.updatedRecords[selectedRowIndex]); } </script> |
We have prepared a sample base on your requirement, find the sample from below location.
Regards,
Dinesh kumar.N
Hi Jorge,
Sorry for the inconvenience caused.
At present there is no support to maintain all selected/unselected rows in TreeGrid for multiple row selection. For this we have already logged a usability feature request regarding this. A support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.
https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents
But we can achieve this by using “RowSelecting” client side event.
Code Snippet:
<ej:TreeGrid ID="Treegrid" runat="server" AllowColumnResize="true" RowSelecting="rowSelecting"> </ej:TreeGrid> <script type="text/javascript"> var selectedRows = [], selectedRecords = []; function rowSelecting(args) { var index = selectedRecords.indexOf(args.data); if (index == -1) { selectedRows.push(args.targetRow[0]); selectedRecords.push(args.data); } else { selectedRows.splice(index, 1); selectedRecords.splice(index, 1); } } </script> |
We have prepared a sample based on your requirement, find the sample from below location.
Sample: http://www.syncfusion.com/downloads/support/forum/121242/ze/Multiple_Rows-265163837
Regards,
Dinesh kumar.N
Hi Jorge,
Please follow up with incident created under your account regarding this feature.
Regards,
Mahalakshmi K.