我面臨的一個問題,下面的代碼綁定樹第一次,但不工作的第二次結合的樹:(但是當我要求三分之一的綁定一次。KendoUI TreeView控件綁定問題
意味着即使是要求工作。
請幫我
在此先感謝
Mobeen
//我的示例數據
{ 「d」:[{ 「_ 類型」: 「ManageUPPRM.UserDocumentDTO」, 「DocumentID」:1804105651, 「DocumentName」: 「谷歌講座」, 「hasChildren」:真正},{ 「 _type」 : 「ManageUPPRM.UserDocumentDTO」, 「DocumentID」:15854591701, 「DocumentName」: 「的desktop.ini」, 「hasChildren」:假},{ 「__類型」: 「ManageUPPRM.UserDocumentDTO」, 「DocumentID」:15861429553, 「DocumentName」 : 「Jellyfish.jpg」, 「hasChildren」:假}]}
//代碼
var datasource = new kendo.data.HierarchicalDataSource({
transport: {
read: function (options) {
var id = options.data.DocumentID;
if (typeof id == "undefined") {
id = "0"
}
$.ajax({
type: "POST",
url: "../ManageUPWebService.asmx/GetAllDocuments",
dataType: "json",
contentType: "application/json; charset=utf-8",
data: "{DocumentID:'" + id + "'}",
success: function (result) {
// notify the data source that the request succeeded
options.success(result.d);
},
error: function (result) {
// notify the data source that the request failed
options.error(result.d);
}
});
}
},
schema: {
model: {
id: "DocumentID",
text: "DocumentName",
hasChildren: "hasChildren"
}
}
});
$("#treeview").kendoTreeView({
checkboxes: {
checkChildren: true,
template: "<input type='checkbox' name='#=item.id#' data-text='#=item.DocumentName#' value='true' />"
},
loadOnDemand: true,
dataSource: datasource,
dataTextField: "DocumentName"
});
一段時間我看到控制檯錯誤錯誤之前:遺漏的類型錯誤:無法調用未定義 – user3496681
「設定」不呼叫時,每次要到服務器你請求json數據 –
你可以嘗試創建重現它的JSFiddle/JSBin嗎? – OnaBai