gpt4 book ai didi

php - 剑道网格行选择

转载 作者:行者123 更新时间:2023-11-29 17:25:31 24 4
gpt4 key购买 nike

如何通过点击获取行 ID?实际上,我想将远程表的行 ID 分配给网格的每一行,然后通过单击它,我想加载第二个网格。有什么解决办法吗?

最佳答案

给你http://jsfiddle.net/qvKRk/

JavaScript

var dataSample = [];
dataSample.push({
OrderID: "1",
ShipName: "line 1"
});
dataSample.push({
OrderID: "2",
ShipName: "line 2"
});
dataSample.push({
OrderID: "3",
ShipName: "line 3"
});

var dataSource = new kendo.data.DataSource({
data: dataSample,
schema: {
model: {
id: "OrderID"
}
},
pageSize: 10
});

$("#grid").kendoGrid({
dataSource: dataSource,
selectable: true,
columns: ["OrderID", "ShipName"],
change: function () {
var row = this.select();
var id = row.data("id");
$("#log").html("selected row with id= " + id);
// sample selecting same row on second grid
// based on this post
var secondGrid = $("#grid2").data("kendoGrid");
var row = secondGrid.table.find('tr[data-id="' + id + '"]');
secondGrid.select(row);
}
});

$("#grid2").kendoGrid({
dataSource: dataSource,
selectable: true,
columns: ["OrderID", "ShipName"]
});

HTML

master grid :
<br />
<div id="grid"></div>
<div id="log"></div>child grid :
<br />
<div id="grid2"></div>

关于php - 剑道网格行选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9130884/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com