Hello,
I have a problem with the HierarchicalDataSource in my treeview. I have a 3+ level datasource. The first and the second level are coming from local data, the third and every following level is coming by a webservice-method.
So far so good: First and second level get displayed perfectly, but with the third one I have some problems. Its loading data, but then it removes the icon (which says that Subfolders exist) and no subfolders are shown.
Fact 1: It jumps into the webservice-method, it returns data (all the subfolders), it gets into the success of the ajax-call
Fact 2: If I remove the second level and make the third+ level as my second one, everything works fine!!! (But I dont want to load the second level again, when I already have it in my folderStructure-object)
Here is my code:
I hope someone can help me,
Thank you,
Best regards.
I have a problem with the HierarchicalDataSource in my treeview. I have a 3+ level datasource. The first and the second level are coming from local data, the third and every following level is coming by a webservice-method.
So far so good: First and second level get displayed perfectly, but with the third one I have some problems. Its loading data, but then it removes the icon (which says that Subfolders exist) and no subfolders are shown.
Fact 1: It jumps into the webservice-method, it returns data (all the subfolders), it gets into the success of the ajax-call
Fact 2: If I remove the second level and make the third+ level as my second one, everything works fine!!! (But I dont want to load the second level again, when I already have it in my folderStructure-object)
Here is my code:
var dataSource = new kendo.data.HierarchicalDataSource({
data: folderStructure,
schema: {
model: {
id: "Id",
hasChildren: "HasChilds",
children:
{
schema: {
data: "items",
model: {
id: "Id",
hasChildren: "HasChilds",
children: {
transport: {
read: function (options)
{
var id = options.data.Id;
$.ajax({
type: "POST",
url: webserviceUrl + "/GetSubFolders",
data: JSON.stringify({ parentFolderId: id }),
processData: false,
contentType: "application/json; charset=utf-8",
dataType: "json",
xhrFields: {
withCredentials: true
},
success: function (data)
{
options.success(JSON.parse(data.d));
},
error: function (data)
{
options.error(data);
}
});
}
},
schema: {
model: {
id: "Id",
hasChildren: "HasChilds"
}
}
}
}
}
}
}
}
});
I hope someone can help me,
Thank you,
Best regards.