We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Getting all selected rows

Thread ID:

Created:

Updated:

Platform:

Replies:

121242 Nov 23,2015 12:40 PM UTC Jan 22,2016 12:47 PM UTC ASP.NET Web Forms 5
loading
Tags: TreeGrid
Jorge Pampin
Asked On November 23, 2015 12:40 PM UTC

Hello,

How to get all selected rows of the TreeGrid by javascript?

Thanks!

Dinesh Kumar Nagarathinam [Syncfusion]
Replied On November 24, 2015 12:58 PM UTC

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.

Sample: http://www.syncfusion.com/downloads/support/forum/121242/ze/Multiple_selected_row_collection-10427508

Regards,

Dinesh kumar.N


Jorge Pampin
Replied On November 24, 2015 04:35 PM UTC

Hello,

This is a big problem. If you can select more than one row, you should access to all selected rows.... In the sample, what about if you unselect rows?

Thanks!

Dinesh Kumar Nagarathinam [Syncfusion]
Replied On November 25, 2015 11:46 AM UTC

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


Jorge Pampin
Replied On January 21, 2016 05:04 PM UTC

Hello,

With the current version, can I access to the selected rows by javascript?

Thanks!

Mahalakshmi Karthikeyan [Syncfusion]
Replied On January 22, 2016 12:47 PM UTC

Hi Jorge,

Please follow up with incident created under your account regarding this feature.

Regards,

Mahalakshmi K.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;