the result for the post processing works for the following:
return o && { title: o.combndName, key: o.parentSqn, folder: true , lazy: true};
However, the data set for the child elements do not have title and key natively and also need to be mapped to those names.
How to create a post processing for lazy loaded child nodes?
function getTreeData() {
$.getScript('//cdn.jsdelivr.net/npm/jquery.fancytree@2.27/dist/jquery.fancytree-all-deps.min.js', function () {
$("#tree").fancytree({
source:
{
url: "/api/treetoplevel",
data : {}
},
postProcess: function (event, data) { // activate lazy loading.
data.result = $.map(data.response, function (o) {
return o && { title: o.combndName, key: o.parentSqn, folder: true , lazy: true};//transform to tree output. TODO: play with columns after.
});
},
activate: function(event, data){
var node = data.node;
alert(node.key)
},
lazyLoad: function(event, data) {
var node = data.node;
data.result = {
url: "/api/tree/" + node.key.toString(),
//url : "parent.json",
data: { mode: "children", parent: node.key },
cache: false
};
}
});
});
};