简体   繁体   English

使用 jquery 从剑道网格中获取单元格值

[英]Get cell value from kendo grid using jquery

How to get the kendo grid cell value using jquery function?Am new to kendo grid如何使用jquery函数获取剑道网格单元格值? 剑道网格新手

{field:abc,title:values}

I need the abc value in javascript or jquery?我需要 javascript 或 jquery 中的 abc 值吗?

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 selectedItem 可让您访问模型上的所有属性

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.注意:基本上,KendoGrid 所有行都分配了唯一的 uid 属性,用于标识每一行。 So if you are having uid then you can follow these steps:因此,如果您有 uid,那么您可以按照以下步骤操作:

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;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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