0
我有一個劍道下降Downlist下面的代碼結合到一個REST終點綁定劍道的DropDownList的RESTful Web服務
ddChange.kendoDropDownList({
dataSource: {
transport: {
read: {
url: "http://localhost/Project/MyMethod",
dataType: "json"
},
parameterMap: function() {
return {
source: data.source,
c: data.c,
ch: data.ch,
};
},
schema: {
data: function (response) {
return $.parseJSON(response);
}
}
}
},
dataTextField: "name",
dataValueField: "id",
change: ddChange
});
一切都看似工作,除了端部。致電http://localhost/Project/MyMethod?source=1&c=2&ch=3
發生,我可以看到它發生並返回正確的數據,但schema > data
return $.parseJSON(response);
不是我的下拉只是包含許多未定義的條目,因爲我剩下一個字符串,仍然需要解析爲一個數組。
這樣做是否適用於Kendo Grid,它是否適用於下拉列表?我錯過了什麼嗎?
爲什麼你解析響應,如果它已經在json? – NunoCarmo
它不是JSON,它是一個JSON字符串,它被解析爲一個對象。我可能會誤解艱難的事情。 – Matt
你能分享一個你的迴應數據的例子嗎? – NunoCarmo