I have tree a implemented using jstree and working perfectly but i want a popup whenever the child node is clicked inorder to edit the name and status of the child node.i searched alot to find anything related to that but can't find anything solid to my situation
here is my code
var classMasterHierarchyTree = (function() {
var classMasterHierarchyTree = null;
$.ajax({
'async' : false,
'global' : false,
'url' : "find_classmastertree",
'dataType' : "json",
'success' : function(data) {
classMasterHierarchyTree = data;
}
});
return classMasterHierarchyTree;
})();
$(document).ready(function () {
//tree
function buildNestedList(treeNodes, rootId) {
var nodesByParent = {};
$.each(treeNodes, function(i, node) {
if (!(node.parent in nodesByParent))
nodesByParent[node.parent] = [];
nodesByParent[node.parent].push(node);
});
function buildTree(children) {
var $container = $("<ul >");
if (!children)
return;
$
.each(
children,
function(i, child) {
$(
'<li data-toggle="modal" data-target="#custom-width-modal">',
{
text:child.name
}).appendTo($container).append(buildTree(nodesByParent[child.id]));
});
return $container;
}
return buildTree(nodesByParent[rootId]);
}
var treeNodes = classMasterHierarchyTree;
$("#basicTree").append(buildNestedList(treeNodes, 0));
});
I just added data-toggle="modal" data-target="#custom-width-modal"
in <li>
then popup shows at the time of expansion,collapsion and even in child and parent nodes clicks. but i want the popup only on child nodes