Hi,
I have been looking for some sort of help regarding filtering for cascading dropdown, below is my code:
var StatedataSource = new kendo.data.DataSource({
transport: {
read: {
type: "POST",
url: "GetDocumentType.asmx/GetStateList",
contentType: 'application/json; charset=utf-8',
datatype: "json",
json: false
},
parameterMap: function (options) {
return JSON.stringify(options);
}
},
serverFiltering: true,
schema: {
data: "d",
total: function (result) {
result = result.d || result;
return result.length;
}
}
});
$("#states").kendoDropDownList({
autoBind: false,
dataTextField: "StateName",
dataValueField: "StateID",
dataSource: StatedataSource
});
$("#countries").kendoDropDownList({
dataTextField: "CountryName",
dataValueField: "CountryID",
dataSource: {
serverFiltering: true,
transport: {
read: {
type: "POST",
url: "GetDocumentType.asmx/GetCountryList",
contentType: 'application/json; charset=utf-8',
datatype: "json"
},
parameterMap: function (options) {
return JSON.stringify(options);
}
},
schema: {
data: "d",
total: function (result) {
result = result.d || result;
return result.length;
}
}
},
change: function () {
StatedataSource.filter({
field: "CID",
operator: "eq",
value: parseInt(this.value())
});
}
});
I want to know that how server filtering exactly works? Although I specified filter , all the data from the web service returns and shown in the dropdown. Did I miss something?
Thanks,
Mangesh
I have been looking for some sort of help regarding filtering for cascading dropdown, below is my code:
var StatedataSource = new kendo.data.DataSource({
transport: {
read: {
type: "POST",
url: "GetDocumentType.asmx/GetStateList",
contentType: 'application/json; charset=utf-8',
datatype: "json",
json: false
},
parameterMap: function (options) {
return JSON.stringify(options);
}
},
serverFiltering: true,
schema: {
data: "d",
total: function (result) {
result = result.d || result;
return result.length;
}
}
});
$("#states").kendoDropDownList({
autoBind: false,
dataTextField: "StateName",
dataValueField: "StateID",
dataSource: StatedataSource
});
$("#countries").kendoDropDownList({
dataTextField: "CountryName",
dataValueField: "CountryID",
dataSource: {
serverFiltering: true,
transport: {
read: {
type: "POST",
url: "GetDocumentType.asmx/GetCountryList",
contentType: 'application/json; charset=utf-8',
datatype: "json"
},
parameterMap: function (options) {
return JSON.stringify(options);
}
},
schema: {
data: "d",
total: function (result) {
result = result.d || result;
return result.length;
}
}
},
change: function () {
StatedataSource.filter({
field: "CID",
operator: "eq",
value: parseInt(this.value())
});
}
});
I want to know that how server filtering exactly works? Although I specified filter , all the data from the web service returns and shown in the dropdown. Did I miss something?
Thanks,
Mangesh