Hi,
im tyring to implement a dynamic load, without using any url, but to make a custom loader which gets the data from web service. when i load the root level data, the loading is as expected,
but when expending one of the root parents, then the children data is overring the existed root level and not appended to the expanded parent (as its children data), but just replacing the all treeGrid data.
It's important to mention' that i've checked that the children data of the expanded node are as expected, and that all the chidrens holds the correct 'parentId' property,
which points to the expanded node that was pressed.
$('#treeDiv').treegrid({
loader: function(param, success, error) {
if (!param.id) {
data = getData(); // retrieve the top level data.
success(data);
}
else {
data = getData(param.id); // retrieve the children data of the current expanded node.
success(data); // here, the data will be replaced and won't be appended to the expanded node.
}
}
});
Example of the data:
root level:
[{id: 1,
name: 'parent 1',
parentId: 0}
]
children data of the expanded parent:
[{id: 11,
name: 'child 1',
parentId: 1},
{id: 12,
name: 'child 2',
parentId: 1},
{id: 13,
name: 'child 23',
parentId: 1}
]