2013-02-21 65 views
0

我試圖通過應用搜索​​過濾器爲每列申請我的網格進行全局搜索過濾器:過濾整列包含

filter.push(
    //strings 
    { field: "Name", operator: "contains", value: item }, 
    { field: "City", operator: "contains", value: item }, 
    { field: "StreetAddress", operator: "contains", value: item }, 

    //integers 
    { field: "Zip", operator: "iscontainedin", value: item } 
); 

//apply filters with 'or logic' (searchterm is contained somewhere in the row) 
$("#Grid").data("kendoGrid").dataSource.filter({ 
    logic: "or", 
    filters: filter 
}); 

這對我的作品,除了那些數據類型不列串。 我知道我可以使用運營商「isequalto」(http://docs.kendoui.com/api/wrappers/aspnet-mvc/Kendo.Mvc/FilterOperator),但我希望有一個包含的功能對整數太像1234包含23 ...

這是可能的,或者是有可能更好的解決archieve一個全局搜索字段,可以將過濾應用於表格的所有列(無需手動設置)?

回答

1

好吧,我最終做了以下內容: 我增加了一個附加字段到我的模型,它是隻喜歡「字段1場2場3」的所有其他領域的串聯,然後我就用我的包含在這一領域過濾器-骨料。 這對我的需求非常好! (希望它可以幫助別人......)