|
123 | 123 | }); |
124 | 124 | mo.observe(this.$chartContainer[0], { childList: true }); |
125 | 125 | }, |
| 126 | + triggerInsertEvent: function (edge,rel) { |
| 127 | + var initEvent = $.Event('insert.orgchart.'+rel); |
| 128 | + edge.trigger(initEvent); |
| 129 | + }, |
| 130 | + triggerShowEvent: function (edge,rel) { |
| 131 | + var initEvent = $.Event('show.orgchart.'+rel); |
| 132 | + edge.trigger(initEvent); |
| 133 | + }, |
| 134 | + triggerHideEvent: function (edge,rel) { |
| 135 | + var initEvent = $.Event('hide.orgchart.'+rel); |
| 136 | + edge.trigger(initEvent); |
| 137 | + }, |
126 | 138 | // |
127 | 139 | attachExportButton: function () { |
128 | 140 | var that = this; |
|
770 | 782 | } else { |
771 | 783 | that.addSiblings($edge.parent(), data.siblings ? data.siblings : data); |
772 | 784 | } |
| 785 | + that.triggerInsertEvent($edge.parent(),rel); |
773 | 786 | } |
774 | 787 | }) |
775 | 788 | .fail(function () { |
|
802 | 815 | if (parentState.visible) { |
803 | 816 | this.hideParent($node); |
804 | 817 | $parent.one('transitionend', { 'topEdge': $topEdge }, this.HideFirstParentEnd.bind(this)); |
| 818 | + this.triggerHideEvent($node,'parent'); |
805 | 819 | } else { // show the ancestors and siblings |
806 | 820 | this.showParent($node); |
| 821 | + this.triggerShowEvent($node,'parent'); |
807 | 822 | } |
808 | 823 | } else { // load the new parent node of the specified node by ajax request |
809 | 824 | // start up loading status |
|
826 | 841 | // hide the descendant nodes of the specified node |
827 | 842 | if (childrenState.visible) { |
828 | 843 | this.hideChildren($node); |
| 844 | + this.triggerHideEvent($node,'children'); |
829 | 845 | } else { // show the descendants |
830 | 846 | this.showChildren($node); |
| 847 | + this.triggerShowEvent($node,'children'); |
831 | 848 | } |
832 | 849 | } else { // load the new children nodes of the specified node by ajax request |
833 | 850 | if (this.startLoading($bottomEdge)) { |
|
853 | 870 | if ($hEdge.is('.leftEdge')) { |
854 | 871 | if ($prevSib.is('.hidden')) { |
855 | 872 | this.showSiblings($node, 'left'); |
| 873 | + this.triggerShowEvent($node,'siblings'); |
856 | 874 | } else { |
857 | 875 | this.hideSiblings($node, 'left'); |
| 876 | + this.triggerHideEvent($node,'siblings'); |
858 | 877 | } |
859 | 878 | } else { |
860 | 879 | if ($nextSib.is('.hidden')) { |
861 | 880 | this.showSiblings($node, 'right'); |
| 881 | + this.triggerShowEvent($node,'siblings'); |
862 | 882 | } else { |
863 | 883 | this.hideSiblings($node, 'right'); |
| 884 | + this.triggerHideEvent($node,'siblings'); |
864 | 885 | } |
865 | 886 | } |
866 | 887 | } else { |
867 | 888 | if (siblingsState.visible) { |
868 | 889 | this.hideSiblings($node); |
| 890 | + this.triggerHideEvent($node,'siblings'); |
869 | 891 | } else { |
870 | 892 | this.showSiblings($node); |
| 893 | + this.triggerShowEvent($node,'siblings'); |
871 | 894 | } |
872 | 895 | } |
873 | 896 | } else { |
|
0 commit comments