|
641 | 641 | // start up loading status |
642 | 642 | if (startLoading($that, $node, opts)) { |
643 | 643 | // load new nodes |
644 | | - $.ajax({ 'url': opts.ajaxURL.parent + nodeId + '/', 'dataType': 'json' }) |
| 644 | + $.ajax({ 'url': $.isFunction(opts.ajaxURL.parent) ? opts.ajaxURL.parent(nodeData) : opts.ajaxURL.parent + nodeId, 'dataType': 'json' }) |
645 | 645 | .done(function(data) { |
646 | 646 | if ($node.closest('.orgchart').data('inAjax')) { |
647 | 647 | if (!$.isEmptyObject(data)) { |
|
673 | 673 | } else { // load the new children nodes of the specified node by ajax request |
674 | 674 | var nodeId = $that.parent()[0].id; |
675 | 675 | if (startLoading($that, $node, opts)) { |
676 | | - $.ajax({ 'url': opts.ajaxURL.children + nodeId + '/', 'dataType': 'json' }) |
| 676 | + $.ajax({ 'url': $.isFunction(opts.ajaxURL.children) ? opts.ajaxURL.children(nodeData) : opts.ajaxURL.children + nodeId, 'dataType': 'json' }) |
677 | 677 | .done(function(data, textStatus, jqXHR) { |
678 | 678 | if ($node.closest('.orgchart').data('inAjax')) { |
679 | 679 | if (data.children.length) { |
|
749 | 749 | } else { |
750 | 750 | // load the new sibling nodes of the specified node by ajax request |
751 | 751 | var nodeId = $that.parent()[0].id; |
752 | | - var url = (getNodeState($node, 'parent').exist) ? opts.ajaxURL.siblings : opts.ajaxURL.families; |
| 752 | + var url = (getNodeState($node, 'parent').exist) ? |
| 753 | + ($.isFunction(opts.ajaxURL.siblings) ? opts.ajaxURL.siblings(nodeData) : opts.ajaxURL.siblings + nodeId) : |
| 754 | + ($.isFunction(opts.ajaxURL.families) ? opts.ajaxURL.families(nodeData) : opts.ajaxURL.families + nodeId); |
753 | 755 | if (startLoading($that, $node, opts)) { |
754 | | - $.ajax({ 'url': url + nodeId + '/', 'dataType': 'json' }) |
| 756 | + $.ajax({ 'url': url, 'dataType': 'json' }) |
755 | 757 | .done(function(data, textStatus, jqXHR) { |
756 | 758 | if ($node.closest('.orgchart').data('inAjax')) { |
757 | 759 | if (data.siblings || data.children) { |
|
0 commit comments