我似乎无法过滤使用多选数据源中的“包含”过滤器运算符。我正在使用AngularJS并提供示例,我修改了Telerik演示站点上的MultiSelect示例。即使我指定“包含”,它也会使用“starts-with”进行过滤:
angular.module("KendoDemos", ["kendo.directives"]);
function MyCtrl($scope) {
$scope.selectOptions = {
placeholder: "Select products...",
dataTextField: "ProductName",
dataValueField: "ProductID",
autoBind: false,
dataSource: {
type: "odata",
serverFiltering: false,
filter: {
field: "ProductName",
operator: "contains"
},
transport: {
read: {
url: "http://demos.telerik.com/kendo-ui/service/Northwind.svc/Products",
}
}
}
};
$scope.selectedIds = [4, 7];
}
答案 0 :(得分:1)
您想要指定窗口小部件的过滤行为,而不是数据源过滤器,因此您需要对多选窗口小部件使用filter
选项:
angular.module("KendoDemos", ["kendo.directives"]);
function MyCtrl($scope) {
$scope.selectOptions = {
placeholder: "Select products...",
dataTextField: "ProductName",
dataValueField: "ProductID",
autoBind: false,
filter: "contains",
dataSource: {
type: "odata",
serverFiltering: false,
transport: {
read: {
url: "...",
}
}
}
};
$scope.selectedIds = [4, 7];
}