After searching and looking deep into the code i found the solution :
$(function(){
var tree3 = $("#tree3").fancytree({
checkbox: true,
selectMode: 3,
source: $.ajax({
url: "/getlist",
dataType: "json"
}),
select: function(event, data) {
// Get a list of all selected nodes, and convert to a key array:
var selKeys =
$.map(data.tree.getSelectedNodes(), function(node) {
if(node.key != 0){
return node.key;
}
});
var rootstructures =
$.map(selKeys, function(item){
var tempnode = data.tree.getNodeByKey(item);
var tempstructure = [];
tempstructure.push(data.tree.getNodeByKey(item).title);
while(tempnode.getParent().getParent()){
tempstructure.push(tempnode.getParent().title);
tempnode = tempnode.getParent();
}
tempstructure.reverse();
return tempstructure.join('/');
});
// WRITE DEBUG OUTPUT TO DIVS
$("#echoSelectionRoots4").text(rootstructures);
$("#echoSelection3").text(selKeys.join(", "));
// Get a list of all selected TOP nodes
var selRootNodes = data.tree.getSelectedNodes(true);
// ... and convert to a key array:
var selRootKeys = $.map(selRootNodes, function(node){
return node.key;
});
$("#echoSelectionRootKeys3").text(selRootKeys.join(", "));
$("#echoSelectionRoots3").text(selRootNodes.join(", "));
// -----------------
},
});
});
This implementation works and now on selection the path till root node is populated on the echoSelectionRoots4 object.
Example Output : /image_test/image5/img_01.png, /image_test/image5/img_02.png etc