I need help. The coding below run perfectly with local data but when implement it with remote data the function for tv.dataItems() show nothing. How can i access the data from the hierarchical data for my treeview? i want to get all the id for the nodes of the treeview.
JavaScript for accessing the dataItem
var values = ["LA1","LA6","LA12"];
var setTreeViewValues = function(values) {
var tv = $("#AccountingTree").data("kendoTreeView");
document.write(JSON.stringify(tv));
tv.dataItems().forEach(function(dataItem) {
alert("test");
if (dataItem.hasChildren) {
var childItems = dataItem.children.data();
//document.write(JSON.stringify(childItems[0].items[0].programID));
}
// document.write(JSON.stringify(dataItem.items));
if (values.indexOf(childItems[0].items[0].programID) > -1) {
dataItem.set("checked", true);
}
});
};
setTreeViewValues(values);
Is there anyone know what the problem happen here?
Aucun commentaire:
Enregistrer un commentaire