|
122 | 122 | });
|
123 | 123 | mo.observe(this.$chartContainer[0], { childList: true });
|
124 | 124 | },
|
| 125 | + triggerInsertEvent: function (edge,rel) { |
| 126 | + var initEvent = $.Event('insert.orgchart.'+rel); |
| 127 | + edge.trigger(initEvent); |
| 128 | + }, |
| 129 | + triggerShowEvent: function (edge,rel) { |
| 130 | + var initEvent = $.Event('show.orgchart.'+rel); |
| 131 | + edge.trigger(initEvent); |
| 132 | + }, |
| 133 | + triggerHideEvent: function (edge,rel) { |
| 134 | + var initEvent = $.Event('hide.orgchart.'+rel); |
| 135 | + edge.trigger(initEvent); |
| 136 | + }, |
125 | 137 | //
|
126 | 138 | attachExportButton: function () {
|
127 | 139 | var that = this;
|
|
761 | 773 | } else {
|
762 | 774 | that.addSiblings($edge.parent(), data.siblings ? data.siblings : data);
|
763 | 775 | }
|
| 776 | + that.triggerInsertEvent($edge.parent(),rel); |
764 | 777 | }
|
765 | 778 | })
|
766 | 779 | .fail(function () {
|
|
793 | 806 | if (parentState.visible) {
|
794 | 807 | this.hideParent($node);
|
795 | 808 | $parent.one('transitionend', { 'topEdge': $topEdge }, this.HideFirstParentEnd.bind(this));
|
| 809 | + this.triggerHideEvent($node,'parent'); |
796 | 810 | } else { // show the ancestors and siblings
|
797 | 811 | this.showParent($node);
|
| 812 | + this.triggerShowEvent($node,'parent'); |
798 | 813 | }
|
799 | 814 | } else { // load the new parent node of the specified node by ajax request
|
800 | 815 | // start up loading status
|
|
817 | 832 | // hide the descendant nodes of the specified node
|
818 | 833 | if (childrenState.visible) {
|
819 | 834 | this.hideChildren($node);
|
| 835 | + this.triggerHideEvent($node,'children'); |
820 | 836 | } else { // show the descendants
|
821 | 837 | this.showChildren($node);
|
| 838 | + this.triggerShowEvent($node,'children'); |
822 | 839 | }
|
823 | 840 | } else { // load the new children nodes of the specified node by ajax request
|
824 | 841 | if (this.startLoading($bottomEdge)) {
|
|
844 | 861 | if ($hEdge.is('.leftEdge')) {
|
845 | 862 | if ($prevSib.is('.hidden')) {
|
846 | 863 | this.showSiblings($node, 'left');
|
| 864 | + this.triggerShowEvent($node,'siblings'); |
847 | 865 | } else {
|
848 | 866 | this.hideSiblings($node, 'left');
|
| 867 | + this.triggerHideEvent($node,'siblings'); |
849 | 868 | }
|
850 | 869 | } else {
|
851 | 870 | if ($nextSib.is('.hidden')) {
|
852 | 871 | this.showSiblings($node, 'right');
|
| 872 | + this.triggerShowEvent($node,'siblings'); |
853 | 873 | } else {
|
854 | 874 | this.hideSiblings($node, 'right');
|
| 875 | + this.triggerHideEvent($node,'siblings'); |
855 | 876 | }
|
856 | 877 | }
|
857 | 878 | } else {
|
858 | 879 | if (siblingsState.visible) {
|
859 | 880 | this.hideSiblings($node);
|
| 881 | + this.triggerHideEvent($node,'siblings'); |
860 | 882 | } else {
|
861 | 883 | this.showSiblings($node);
|
| 884 | + this.triggerShowEvent($node,'siblings'); |
862 | 885 | }
|
863 | 886 | }
|
864 | 887 | } else {
|
|
0 commit comments