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

Accessing (model) values of selected row

2 Answers 689 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bjarke
Top achievements
Rank 1
Bjarke asked on 25 Apr 2012, 11:32 AM
How do I access the (model) values of a selected row using the new 2012 Kendo UI Web? I.e. in the change event of a Kendo grid.

Where do I find more resources on this topic and also on models in the 2012 version? I haven't found the answers in the datasource or grid documentation/demos sections.

2 Answers, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 27 Apr 2012, 02:13 PM
Hello Bjarke,

The easiest way to get reference to the data record assign to given grid data row is by using dataItem method. For example:

var grid = $("#grid").data("kendoGrid");
 
grid.bind("change", function() {
    //if grid single row selection is enabled
    var model = grid.dataItem(grid.select());
 
    //get the value of the foo field
    console.log("value of foo is ", model.foo);
});


Greetings,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Michel Corbin
Top achievements
Rank 1
answered on 23 Aug 2012, 04:01 PM
Does it work with server-side binding? I mean, when I create a grid with Html.Helpers...
Tags
Grid
Asked by
Bjarke
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Michel Corbin
Top achievements
Rank 1
Share this question
or