dabeng / OrgChart

It's a simple and direct organization chart plugin. Anytime you want a tree-like chart, you can turn to OrgChart.
MIT License
2.87k stars 772 forks source link

Can only go up one level when loading nodes on demand #65

Open azureskydiver opened 8 years ago

azureskydiver commented 8 years ago

When I setup AJAX URLs to load nodes on demand, exploring the tree upward will only let me go up one level.

The source of the issue seems to come from:

  // build the parent node of specific node
  function buildParentNode($currentRoot, nodeData, opts, callback) {
    var that = this;
    var $table = $('<table>');
    nodeData.relationship = '001';
:
  }
dabeng commented 8 years ago

thanks a lot,i think it's necessary to add a method addAncestors()

HueyHQ commented 8 years ago

Having the same problem - commented out the nodeData.relationship = '001' line, and it works as expected. Any reason this is hard-coded when this already has the correct value passed in? I have tested it with relationship unpopulated, and there was no catastrophic failure, just no arrows on the node.

tenbaset commented 7 years ago

@HueyHQ: I found the hard coding is for 'addParent(..)' without the on-demand loading. (Commenting out that line will break the "I wanna edit orgchart" example -- if you try to add a parent node, the tree won't be coherent - the arrows don't quite work right).

However, I think this issue is now resolved in PR #133 , which I believe is released.