1

我似乎无法在多选数据源中使用“包含”过滤器运算符进行过滤。我正在使用 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];
}

演示:http: //jsbin.com/riwavomeleza/1/edit

4

1 回答 1

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];
}
于 2014-08-12T01:12:43.813 回答