gpt4 book ai didi

javascript - kendo grid如何按字段值获取行

转载 作者:搜寻专家 更新时间:2023-11-01 04:46:35 25 4
gpt4 key购买 nike

我需要从我的剑道网格中获取一行,使用一个字符串作为参数来过滤行。网格模型是:

{
id: "id_tipo_pagamento",
fields: {
id_tipo_pagamento: { type: "number", editable: false },
desc_tipo_pagamento: { type: "string"}
}

我试过了,但是没有用:

 var grid = $("#kendoGrid").data("kendoGrid");
var row = grid.tbody.find("tr[desc_tipo_pagamento=test]");

最佳答案

我建议不要使用 DOM,而是使用 jQuery.grepDataSource.data 上数组(如果你想要全部)或 DataSource.view如果你想从当前可见的。

例子:

// Retrieve all data from the DataSource
var data = grid.dataSource.data();
// Find those records that have desc_tipo_pagamento set to "test"
// and return them in `res` array
var res = $.grep(data, function (d) {
return d.desc_tipo_pagamento == "test";
});

res将包含对数据源中符合条件的记录的引用。

关于javascript - kendo grid如何按字段值获取行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19276994/

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