From b217759f82946be51e8aece3fcca1b1089a08d6b Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 2 Dec 2021 23:42:54 +0300 Subject: [PATCH] [Common] ComboDataView: add groups for DataView, refactoring item template --- .../main/lib/component/ComboDataView.js | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/apps/common/main/lib/component/ComboDataView.js b/apps/common/main/lib/component/ComboDataView.js index fb0b1af65..6597591ba 100644 --- a/apps/common/main/lib/component/ComboDataView.js +++ b/apps/common/main/lib/component/ComboDataView.js @@ -81,6 +81,7 @@ define([ this.style = this.options.style; this.hint = this.options.hint; this.store = this.options.store || new Common.UI.DataViewStore(); + this.groups = this.options.groups; this.itemWidth = this.options.itemWidth; this.itemHeight = this.options.itemHeight; this.menuMaxHeight = this.options.menuMaxHeight; @@ -92,18 +93,19 @@ define([ this.needFillComboView = false; this.minWidth = this.options.minWidth; this.delayRenderTips = this.options.delayRenderTips || false; + this.itemTemplate = this.options.itemTemplate || _.template([ + '
', + '', + '<% if (typeof title !== "undefined") {%>', + '<%= title %>', + '<% } %>', + '
' + ].join('')); this.fieldPicker = new Common.UI.DataView({ cls: 'field-picker', allowScrollbar: false, - itemTemplate : _.template([ - '
', - '', - '<% if (typeof title !== "undefined") {%>', - '<%= title %>', - '<% } %>', - '
' - ].join('')), + itemTemplate : this.itemTemplate, delayRenderTips: this.delayRenderTips }); @@ -128,15 +130,9 @@ define([ restoreHeight: this.menuMaxHeight, style: 'max-height: '+this.menuMaxHeight+'px;', enableKeyEvents: this.options.enableKeyEvents, + groups: this.groups, store: this.store, - itemTemplate : _.template([ - '
', - '', - '<% if (typeof title !== "undefined") {%>', - '<%= title %>', - '<% } %>', - '
' - ].join('')), + itemTemplate : this.itemTemplate, delayRenderTips: this.delayRenderTips });