From a94a30362b259bf590fe4ba2ad8ff75649311980 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 25 Jun 2019 10:39:09 +0300 Subject: [PATCH] [SSE] Show specified formula group --- .../main/app/controller/FormulaDialog.js | 8 ++++---- .../main/app/view/FormulaDialog.js | 14 ++++++-------- apps/spreadsheeteditor/main/app/view/FormulaTab.js | 4 ++-- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/FormulaDialog.js b/apps/spreadsheeteditor/main/app/controller/FormulaDialog.js index f7d864414..730a51d60 100644 --- a/apps/spreadsheeteditor/main/app/controller/FormulaDialog.js +++ b/apps/spreadsheeteditor/main/app/controller/FormulaDialog.js @@ -86,10 +86,10 @@ define([ }); }, - applyFunction: function(func, autocomplete) { + applyFunction: function(func, autocomplete, group) { if (func) { if (func.origin === 'more') { - this.showDialog(); + this.showDialog(group); } else { this.api.asc_insertFormula(func.name, Asc.c_oAscPopUpSelectorType.Func, !!autocomplete); !autocomplete && this.updateLast10Formulas(func.origin); @@ -202,7 +202,7 @@ define([ return null; }, - showDialog: function () { + showDialog: function (group) { if (this.formulas) { if ( this.needUpdateFormula ) { this.needUpdateFormula = false; @@ -211,7 +211,7 @@ define([ this.formulas.fillFormulasGroups(); } } - this.formulas.show(); + this.formulas.show(group); } }, hideDialog: function () { diff --git a/apps/spreadsheeteditor/main/app/view/FormulaDialog.js b/apps/spreadsheeteditor/main/app/view/FormulaDialog.js index 4515cb475..992e37066 100644 --- a/apps/spreadsheeteditor/main/app/view/FormulaDialog.js +++ b/apps/spreadsheeteditor/main/app/view/FormulaDialog.js @@ -104,7 +104,7 @@ define([ this.descLabel = $('#formula-dlg-desc'); this.fillFormulasGroups(); }, - show: function () { + show: function (group) { if (this.$window) { var main_width, main_height, top, left, win_height = this.initConfig.height; @@ -129,8 +129,8 @@ define([ this.mask.on('mousedown',_.bind(this.onUpdateFocus, this)); this.$window.on('mousedown',_.bind(this.onUpdateFocus, this)); - if (this.cmbFuncGroup.getValue() == 0) - this.fillFunctions('Last10'); + group && this.cmbFuncGroup.setValue(group); + (group || this.cmbFuncGroup.getValue()=='Last10') && this.fillFunctions(this.cmbFuncGroup.getValue()); if (this.cmbListFunctions) { _.delay(function (me) { @@ -169,9 +169,7 @@ define([ }, onSelectGroup: function (combo, record) { if (!_.isUndefined(record) && !_.isUndefined(record.value)) { - if (record.value < this.formulasGroups.length) { - this.fillFunctions(this.formulasGroups.at(record.value).get('name')); - } + record.value && this.fillFunctions(record.value); } this.onUpdateFocus(); @@ -213,7 +211,7 @@ define([ var group = this.formulasGroups.at(i); if (group.get('functions').length) { groupsListItems.push({ - value : group.get('index'), + value : group.get('name'), displayValue : group.get('caption') }); } @@ -232,7 +230,7 @@ define([ } else { this.cmbFuncGroup.setData(groupsListItems); } - this.cmbFuncGroup.setValue(0); + this.cmbFuncGroup.setValue('Last10'); this.fillFunctions('Last10'); } diff --git a/apps/spreadsheeteditor/main/app/view/FormulaTab.js b/apps/spreadsheeteditor/main/app/view/FormulaTab.js index d04c93964..f482e3192 100644 --- a/apps/spreadsheeteditor/main/app/view/FormulaTab.js +++ b/apps/spreadsheeteditor/main/app/view/FormulaTab.js @@ -281,7 +281,7 @@ define([ items: arr })); btn.menu.on('item:click', function (menu, item, e) { - me.fireEvent('function:apply', [{name: item.caption, origin: item.value}]); + me.fireEvent('function:apply', [{name: item.caption, origin: item.value}, false, name]); }); } } @@ -335,7 +335,7 @@ define([ }) }); mnu.menu.on('item:click', function (menu, item, e) { - me.fireEvent('function:apply', [{name: item.caption, origin: item.value}]); + me.fireEvent('function:apply', [{name: item.caption, origin: item.value}, false, name]); }); morearr.push(mnu); }