It seems that if you use jquery 2 (not much tested but that's the big difference I see at the moment after comparing the example to my use case)
$.each(nodeData.children, function (index, child) {
child.parentId = nodeData.id;
});
at this line throws an error (Uncaught TypeError: Cannot read property 'length' of undefined) if there is any element that has no 'children' attribute if you use local json datasource. Problem could be easily fixed if you wrap a check around it, e.g. changing it to:
if ('undefined' !== typeof nodeData.children) {
$.each(nodeData.children, function (index, child) {
child.parentId = nodeData.id;
});
}
It seems that if you use jquery 2 (not much tested but that's the big difference I see at the moment after comparing the example to my use case)
at this line throws an error (
Uncaught TypeError: Cannot read property 'length' of undefined
) if there is any element that has no 'children' attribute if you use local json datasource. Problem could be easily fixed if you wrap a check around it, e.g. changing it to: