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. Image for the cookie policy date
close icon

GridGroupingControl JS get cell value from selected row

Hello,

I need to use the ClientSideOnSelectionChanged in order to get the value of a cell in the selected row.

oData.Row.tableRow is not working for me.

Here is what I have so far:

function OnShowData(oData) {

                var row = oData.Row.tableRow;
                if (row == null) {
                    alert('null');
                }
                else {
                    alert([get cell value from selected row]);
                }
               
            }


<syncfusion:GridGroupingControl ID="grdEvents" runat="server"   
             DataSourceCachingMode="viewstate" 
             EnableCallbacks="true"   ClientSideOnSelectionChanged="OnShowData(this)" >
        
        <TableDescriptor FormEditMode="UseDefaultForm" AllowNew="false" AllowFilter="true"  >
        
        <VisibleColumns>
                            <Syncfusion:GridVisibleColumnDescriptor Name="CompanyName"/>
                            <Syncfusion:GridVisibleColumnDescriptor Name="title"/>
                        </VisibleColumns>
                        <Columns>
                            <Syncfusion:GridColumnDescriptor MappingName="CompanyName"  HeaderText="Entity"/>
                            <Syncfusion:GridColumnDescriptor MappingName="title" HeaderText="Title"/>
                         
                        </Columns>
        
        </TableDescriptor>

        </syncfusion:GridGroupingControl>


2 Replies

ES Eswari S Syncfusion Team June 22, 2012 09:40 AM UTC

Hi Assaf,

Thank you for using Syncfusion products.

Your requirement of getting selected row value can be achieved from current row values instead of table row values. Please refer to the following code snippets:

                                                                                                                 

[JavaScript]

<script type="text/javascript">
        function SelectionChange(gridobj) {
            // Temp record conatins the object binded to current row.
            this.Temprecord = {};
            var visiblecolumns = gridobj.currentRow.gridTable.visibleColumns;   // get the selected record value from currentRow         
            for (var i = 1; i < visiblecolumns.length; i++) {
                this.Temprecord[visiblecolumns[i].name] = gridobj.currentRow.GetValue(visiblecolumns[i].name);
            }
            alert(this.Temprecord["Name"]);
        }
    </script>

 

 

[Aspx]

 

<syncfusion:GridGroupingControl ID="GridGroupingControl1" runat="server" ShowHeaderGroupingIndicators="false" ShowIndicator="false"
        AutoFormat="Office 2007 Blue" BorderCollapse="Separate" DataSourceCachingMode="ViewState" ClientSideOnSelectionChanged="SelectionChange(this)">
        . . . .
        </Syncfusion:GridGroupingControl>

 

For your convenience , we have prepared the sample and the same can be downloaded from the following link:    

 

http://www.syncfusion.com/downloads/Support/DirectTrac/95502/Sample1116395137.zip

 

Please try this and let us know if you have any other queries.

 

Regards,

Eswari.S                                                                                                                                                         

 

 

 



ES Eswari S Syncfusion Team June 22, 2012 09:45 AM UTC

Hi Assaf,

Sorry for the inconvenience caused.

Sample link modified in our previous update. Please find the updated sample link from the following link:

http://www.syncfusion.com/downloads/Support/DirectTrac/95502/Grid ClientSideSelectionChange-1267473154.zip

Please try this and let us know if you have any other queries.

Regards,

Eswari.S                                                                                                                                                         

 

 

 


Loader.
Live Chat Icon For mobile
Up arrow icon