javascript - Kendo 源过滤器不起作用

标签 javascript kendo-ui durandal

在这里,我的过滤器不起作用。当代码将数据发送到 Controller 时,我收到以下错误。

错误:

An unknown function with name 'contains' was found. This may also be a key lookup on a navigation property, which is not allowed.

代码:

$("#btnSearch").click(function () {
    txt = $("#Where").val();
    filter = "contains(Title,'"+txt+"')";              
    return db.cards('content', page || 1, null, filter).then(function (d) {   
        vm.widgetData.records(d);
    });            
});

最佳答案

我假设 db.cards 是您的一个模块,但格式良好的过滤器如下所示:

var filter=  { field: "Title", operator: "contains", value: txt };
datasource.filter(filter);

运算符包含存在:

http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-filter.operator

关于javascript - Kendo 源过滤器不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26060351/

相关文章:

javascript - 如何自定义您的网站在 iframe 中的显示方式

javascript - 在 BeginContact 事件中设置新的 body 位置

javascript - 如何在 JavaScript 中公开一个方法

javascript - 在 Kendo-UI 中下拉刷新,文本重叠显示 "release"和 "pull"标签

drop-down-menu - 表格中的 Durandal/Knockout 嵌套下拉菜单

typescript - 选择中的此错误

javascript - 误解 Javascript 函数调用

javascript - 如何在 Kendo UI TreeList/Grid 中获取一行?

javascript - 为什么我的剑道窗口会自己打开?

javascript - Durandal showMessage 无法识别断线