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

Hierarchical grid - Read specific cell with javascript

Thread ID:

Created:

Updated:

Platform:

Replies:

116292 May 12,2014 10:19 AM UTC May 26,2014 07:10 AM UTC ASP.NET Web Forms (Classic) 3
loading
Tags: GridGroupingControl
andrea fanara
Asked On May 12, 2014 10:19 AM UTC

Hi,I have a hierarchical grid (two levels:parent rows and child rows).
On the left of the rows I have checkbox. My problem is to read one specific cell. Infact in the table I have:

Data | Mail | State | Id

and in javascript I would like to read the content of cell "id".(is more complex of this  but in brief this is the problem; I can't use c# code for this specific case but I must use only java).
Thanks in advance
Andrea

Satheeskumar S [Syncfusion]
Replied On May 20, 2014 10:02 AM UTC

Hi Andrea,

Thanks for your interest in Syncfusion products.

We are glad to let you know that your requirement can be achieved. We have used RowBtnTemplate to add the Check Box to grid. We have hidden the header check boxes using java script. We have displayed the particular cell content, while check the checkbox.

Please refer the below code snippet.

<script type="text/javascript">

function BeginRequestHandler(sender, args) {

                                    $('input[id *="header"]').hide(); //To remove the check box from header

            }

            Sys.WebForms.PageRequestManager.getInstance().add_endRequest(BeginRequestHandler);   

 

            $(function () {

                                    $('input[id *="header"]').hide(); //to remove the check box from header

            });

            function checkchanged(oData) {

                                    var gridTable = GetEGridTable($get('<%= GridGroupingControl1.ClientID %>'));

                                    var gridObj = gridTable.GetGridObj();

                                    var colIdx = 0;

                                    for (tableName in gridObj.gridTables) {

                                    for (var i in gridObj.gridTables[tableName].visibleColumns) {

                                                var column = gridObj.gridTables[tableName].visibleColumns[i];

                                                if (oData.id.indexOf("NT") == -1) {

                                                             //Parent Grid

                                                             if (column.name == "Customer ID") {

                                                                          if (gridTable.showRowHeader)

                                                                                     colIdx = column.index - 1;

                                                                          else

                                                                                      colIdx = column.index;

                                                                           break;

                                                             }

                                                }

                                                else {

                                                              //Child Grid

                                                              if (column.name == "Ship Name") {

                                                                        if (gridTable.showRowHeader)

                                                                                     colIdx = column.index - 1;

                                                                        else

                                                                                    colIdx = column.index;

                                                                        break;

                                                              }

                                                 }

                                    } //end of loop

                        }

                        if (oData.checked) {

                                    selText = $(oData.parentElement).siblings().eq(colIdx).text();

                                    alert(selText);

                        }

            }

</script>

 

<syncfusion:GridGroupingControl EnableCallbacks="false" ID="GridGroupingControl1"

        <TableDescriptor AllowFilter="False" AllowNew="false" AllowEdit="false">

             <RowBtnTemplate>                                            

                        <asp:Checkbox ID="cbSelect" runat="server" onclick="checkchanged(this);"/>

             </RowBtnTemplate>

        </TableDescriptor>

</syncfusion:GridGroupingControl>

 

For your convenience we have attached the sample. Could you please use this sample and let us know if this is helpful.

Please let us know if you need any further assistance.

Regards,

Satheeskumar S


Attachment: Grouping_IssueData_Import_de8b884e.zip

andrea fanara
Replied On May 23, 2014 01:37 PM UTC

Thanks Satheeskumar!

Eswari S [Syncfusion]
Replied On May 26, 2014 07:10 AM UTC

Hi Andrea,

 

Thanks for your update. Please let us know if you need any further assistance.

 

Regards,

Eswari S

 


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

;