访问kendo网格单元格值

时间:2015-11-25 21:20:17

标签: jquery checkbox typescript kendo-grid

我有一个使用Kendo Grid的Web应用程序。我如何获得" Ticket No"的价值?选中的复选框?

enter image description here

我的代码是:

var grid = $("#poGrid").data("kendoGrid");
grid.items().filter(":has(:checked)").each(function () {
    var tr = $(this);
    console.log(grid.dataItem(tr));
    console.log("Length => " + grid.dataItem(tr.length.toString()));
});

console.log(" grid.items().length => " + grid.items().length);
console.log(" grid.dataItem.ticketNumber => " + grid.dataItem.ticketNumber);    

输出:
enter image description here

1 个答案:

答案 0 :(得分:1)

您可以这样做:

grid.items().filter(":has(:checked)").each(function () {
  var tr = $(this);

  // Current data item
  var dataItem = grid.dataItem(tr);
  console.log(dataItem);

  // Access the ticketNumber
  var ticketNumber = dataitem.ticketNumber;
  console.log("ticketNumber=> " + ticketNumber );
});