[英]How can I get the data from a Kendo grid selected row when using server binding?
[英]How can I get the selected row in Kendo Grid using jQuery
我有以下 jQuery 代码,它可以获取第一行值,但不能获取所选行:
function setStandardName() {
var grid = $("#BillingsGrid").data("kendoGrid");
var dataItem = grid.dataItem("tbody tr:eq(0)");
dataItem.set("Name", "new value");
console.log(dataItem.Name);
};
它找到第一行值,但我需要获取选定的行值
我试过这个:
function setStandardName() {
var grid = $("#BillingsGrid").data("kendoGrid");
var dataItem = grid.dataItem($(this).closest("tr"));
dataItem.set("Name", "new value");
console.log(dataItem.Name);
};
未捕获的类型错误:无法读取此行dataItem.set("Name", "new value");
上的 null 属性“set” dataItem.set("Name", "new value");
像这样尝试。
$('.clickedSomething').click(function() {
var grid = $("#BillingsGrid").data("kendoGrid");
var dataItem = grid.dataItem($(this).closest("tr"));
dataItem.set("Name", "new value");
console.log(dataItem.Name);
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.