![](/img/trans.png)
[英]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.