gpt4 book ai didi

jquery - 搜索 Kendo UI 网格中的所有列

转载 作者:行者123 更新时间:2023-12-03 21:54:43 26 4
gpt4 key购买 nike

我正在尝试为 kendoUI 网格创建一个搜索框。我已经能够开始基于一个字段进行搜索,但是我希望搜索框中的值能够搜索网格中的所有列。

function() {
grid.data("kendoGrid").dataSource.filter({
field: "ProductName",
operator: "contains",
value: $('#category').val()
});

}

See js fiddle example

我尝试在这里使用或逻辑运算符:jsfiddle.net但是我似乎无法让它工作......(请参阅或逻辑按钮)

最佳答案

我认为您应该将 eq 改为 fee eq 改为 fi 如果您想匹配两个条件之一。

我稍微修改了你的fiddle来展示它。如果您在搜索框中键入内容,您将过滤与 ProductName 列或 QuantityPerUnit 匹配的记录。

//change event
$("#category").keyup(function () {
var val = $('#category').val();
$("#grid").data("kendoGrid").dataSource.filter({
logic : "or",
filters: [
{
field : "ProductName",
operator: "contains",
value : val
},
{
field : "QuantityPerUnit",
operator: "contains",
value : val
}
]
});
});

重要:我必须将 jQuery 版本更新到 1.8.2 才能使其正常工作,以防万一我也将 KendoUI 更新到最新版本。

关于jquery - 搜索 Kendo UI 网格中的所有列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13938101/

26 4 0
文章推荐: jquery - 未捕获的类型错误 : Cannot read property 'nodeName' of undefined
文章推荐: JQuery 文件上传错误 : Uncaught TypeError: Object # has no method '_on'