简体   繁体   中英

Get cell value from kendo grid using jquery

How to get the kendo grid cell value using jquery function?Am new to kendo grid

{field:abc,title:values}

I need the abc value in javascript or jquery?

I assume your using single row selection for the Grid. This piece of code will grab any value you need off of the selected row.

$('#ProposalGrid').click(function () {
    var gview = $(this).data("kendoGrid");
    var selectedItem = gview.dataItem(gview.select());
    var Guid = selectedItem.YourPropertyName;

})

selectedItem gives you access to all the properties on your model

If anyone still looking for an answer then you can try using following steps:

Note: Basically KendoGrid all rows have it's unique uid property assigned for identify each row. So if you are having uid then you can follow these steps:

var grid = $("#grid").data("kendoGrid");

var tr = grid.dataSource.getByUid("your-row-uid");

var yourFieldValue = tr.yourFieldName;

Even you can get value throught following steps:

First :

var grid = $("#grid").data("kendoGrid");

Second :

var dataItem = grid.dataItem(grid.select());

or

var dataItem = grid.dataItem($(event.target).closest("tr"));

or

var dataItem = grid.dataItem("tr.k-grid-edit-row");

Third:

var yourFieldValue = dataItem.yourFieldName;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM