From bc396cdefaf072ef4013f7e5561bf05305dbd817 Mon Sep 17 00:00:00 2001 From: Alexei Koshelev Date: Mon, 4 Mar 2024 02:40:59 +0300 Subject: [PATCH] [common] Add event item:expand for TreeView --- apps/common/main/lib/component/TreeView.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/common/main/lib/component/TreeView.js b/apps/common/main/lib/component/TreeView.js index 145dea7735..fffb4db8e5 100644 --- a/apps/common/main/lib/component/TreeView.js +++ b/apps/common/main/lib/component/TreeView.js @@ -248,6 +248,7 @@ define([ record.set('isExpanded', isExpanded); this.store[(isExpanded) ? 'expandSubItems' : 'collapseSubItems'](record); this.scroller.update({minScrollbarLength: this.minScrollbarLength, alwaysVisibleY: this.scrollAlwaysVisible}); + this.trigger('item:expand', record, isExpanded, !isExpanded); } else Common.UI.DataView.prototype.onClickItem.call(this, view, record, e); }, @@ -269,17 +270,21 @@ define([ expandRecord: function(record) { if (record) { + var oldExpand = record.get('isExpanded'); record.set('isExpanded', true); this.store.expandSubItems(record); this.scroller.update({minScrollbarLength: this.minScrollbarLength, alwaysVisibleY: this.scrollAlwaysVisible}); + this.trigger('item:expand', record, true, oldExpand); } }, collapseRecord: function(record) { if (record) { + var oldExpand = record.get('isExpanded'); record.set('isExpanded', false); this.store.collapseSubItems(record); this.scroller.update({minScrollbarLength: this.minScrollbarLength, alwaysVisibleY: this.scrollAlwaysVisible}); + this.trigger('item:expand', record, false, oldExpand); } },