此实例是根据当前数据的某个值动态过滤一个静态的数据源
$scope.serviceItem1Editor=function (container, options) {
var checkedValues=options.model.itemCatCode.split(",");
var filter = {
logic: "or",
filters: $.map(checkedValues, function(value) {
return {
operator: "eq",
field: "itemCat",
value: value
};
})
};
$scope.serviceItemDS.filter(filter);
$("")
.attr("id", "ddl_serviceItem1")
.appendTo(container)
.kendoDropDownList({
dataSource: $scope.serviceItemDS,
dataTextField: "itemDesc",
dataValueField: "itemCode",
template: "${data.itemDesc}"
});
}
$scope.serviceItemDS = new kendo.data.DataSource({
transport: {
read: {
url: $scope.serviceRoot+"/booking/findServicItems",
dataType: "json",
type: "POST",
contentType: "application/json"
},
parameterMap:function(options, operation) {
if(operation==="read"){
var catCode="";
return JSON.stringify(catCode);
}
}
}
});