问题
I am using KendoUi for my project. i created local wcf service and it works well. i tested on the browser and it gives jsondata. but i cannot fetch the data to the aspx page in combobox.
my javascript code for the kendocombobox is below. please help me as soon as possible. please use localhost in place of www.google.com
var ds = new kendo.data.DataSource({ transport: { type: "json", read: { url: "http://www.google.com:2608/Service1.svc/getAllProducts" } }, aggregate: [{ field: "ProductID", aggregate: "sum"}] });
$("#regBody").kendoComboBox({
placeholder: "Select Product",
dataTextField: "ProductName",
dataValueField: "ProductID",
dataSource: ds
}).data("kendoComboBox");
回答1:
No sure what exactly doesn't work - what needs to be fetched to server? If it is a Combobox I assume you want to fetch data entered in the box so the server sends you back filtered result. you need to add
serverFiltering: true
to yourDatasource. If you want just fetch the final value and do something with it you can use a simple Ajax call to do it
here is an example
来源:https://stackoverflow.com/questions/18746379/kendocombobox-is-not-fetching-localsource-jsondata