This is a migrated thread and some comments may be shown as answers.

Easiest Way for Fetching Grid Cell Value

1 Answer 488 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
bhavin
Top achievements
Rank 1
bhavin asked on 15 Oct 2018, 03:09 PM

If I have a simple grid with data like

public gridData = [ {
      "ID": 1,
      "Fax": "",
      "Type": "Client"
    },
    {
      "ID": 2,
      "Fax": "",
      "Type": "Client"
    },]

and grid something like 

<kendo-grid #grid [data]="gridView1"
            [group]="groupGrid1" [scrollable]="true" [resizable]="true">

  <ng-template kendoGridToolbarTemplate>
  </ng-template>
  <kendo-grid-column field="ID" title="ID"></kendo-grid-column>
  <kendo-grid-column field="Fax" title="Fax"></kendo-grid-column>
  <kendo-grid-column field="Type" title="Type"></kendo-grid-column>
</kendo-grid>

which is the easy way to fetch the value for the ID? 
I know you can have something like (click)=onSelect($event)

But this will give you the current event like the mouse click

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 16 Oct 2018, 11:59 AM
Hello Bhavin,

One simple solution to retrieve the related row data on click is to use the Grid cellClick event. I've put together a small example using the provided setup.

On clicking the cell you can access the related dataItem for the corresponding row. It holds the information for the respective data entry (with ID, Fax, etc.).

Regards,
Dimitar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
General Discussions
Asked by
bhavin
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or