$("#rowSelection").kendoGrid({ dataSource: { data: orders }, selectable: "row", columns: [ { field: "ShipCountry", title: "Ship Country", 300 }, { field: "Freight", 300 }, { field: "OrderDate", title: "Order Date", format: "{0:dd/MM/yyyy}" } ] });
Javascript 代码如下:
var grid = $("#grid").data("kendoGrid"); var dataRows = grid.items(); // 获取行号 var rowIndex = dataRows.index(grid.select()); // 获取行对象 var data = grid.dataItem(grid.select());
行双击事件及行数据的取得 //前提 Grid的selectable: "row", $("#gridID").on("dblclick", "tr.k-state-selected", function () { var grid = $("#grid").data("kendoGrid"); var data = grid.dataItem(grid.select()); $("#txt1").val(data.get("ProductID")); $("#txt2").val(data.get("ProductName")); $("#txt3").val(data.get("UnitsInStock")); });
来自:https://blog.csdn.net/jsjpanxiaoyu/article/details/76695544