javascript - Jquery Organization Chart -
my organization chart has testing , developing teams. 1 employee(tester) working in both teams combine developing team tree testing team tree. worked out this no use please me
html
<div class="tree"> <ul id="testing"> <li parent-id=0 emp-id=1>rao</li> <li parent-id=1 emp-id=2>venkat</li> <li parent-id=2 emp-id=3>ragava</li> <li parent-id=3 emp-id=4>basha</li> <li parent-id=3 emp-id=5>tester1</li> <li parent-id=5 emp-id=6>tester1a</li> <li parent-id=5 emp-id=7>tester1b</li> </ul> <ul id="development"> <li parent-id=0 emp-id=8>vengal</li> <li parent-id=8 emp-id=9>naren</li> <li parent-id=9 emp-id=5>tester1</li> </ul> </div>
jquery
var $ul = $('ul'); $ul.find('li[parent-id]').each(function() { $ul.find('li[parent-id=' + $(this).attr('emp-id') + ']').wrapall('<ul />').parent().appendto(this) });
for complete view see demo
Comments
Post a Comment