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

What to do with the dataItem?

1 Answer 1379 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 19 Mar 2013, 03:38 PM
Hi All,

I was wondering, what are you supposed to do with a dataItem ?

In the grid documentation, I saw code that looked like this:

var row = this.select(); // assuming this is single select
var dataItem = this.dataItem(row);

However, I'm not sure what I can call on dataItem.  How do I get the values of the selected row?

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 19 Mar 2013, 05:23 PM
Hi John,


The dataItem method is used to get the data, to which a table row is bound to i.e. an object with the properties for the current item. Assuming that the item has properties age and name, you could get them the following way.

E.g.
var grid = $("#grid").data("kendoGrid");
var selection = grid.select(); //single selection
var rowData = grid.dataItem(selection);
 
var age = rowData.age;
var name = rowData.name;

 

Greetings,
Dimiter Madjarov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
John
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question
or