[SSE] Show specified formula group

This commit is contained in:
Julia Radzhabova 2019-06-25 10:39:09 +03:00
parent 164e295be2
commit a94a30362b
3 changed files with 12 additions and 14 deletions

View file

@ -86,10 +86,10 @@ define([
}); });
}, },
applyFunction: function(func, autocomplete) { applyFunction: function(func, autocomplete, group) {
if (func) { if (func) {
if (func.origin === 'more') { if (func.origin === 'more') {
this.showDialog(); this.showDialog(group);
} else { } else {
this.api.asc_insertFormula(func.name, Asc.c_oAscPopUpSelectorType.Func, !!autocomplete); this.api.asc_insertFormula(func.name, Asc.c_oAscPopUpSelectorType.Func, !!autocomplete);
!autocomplete && this.updateLast10Formulas(func.origin); !autocomplete && this.updateLast10Formulas(func.origin);
@ -202,7 +202,7 @@ define([
return null; return null;
}, },
showDialog: function () { showDialog: function (group) {
if (this.formulas) { if (this.formulas) {
if ( this.needUpdateFormula ) { if ( this.needUpdateFormula ) {
this.needUpdateFormula = false; this.needUpdateFormula = false;
@ -211,7 +211,7 @@ define([
this.formulas.fillFormulasGroups(); this.formulas.fillFormulasGroups();
} }
} }
this.formulas.show(); this.formulas.show(group);
} }
}, },
hideDialog: function () { hideDialog: function () {

View file

@ -104,7 +104,7 @@ define([
this.descLabel = $('#formula-dlg-desc'); this.descLabel = $('#formula-dlg-desc');
this.fillFormulasGroups(); this.fillFormulasGroups();
}, },
show: function () { show: function (group) {
if (this.$window) { if (this.$window) {
var main_width, main_height, top, left, win_height = this.initConfig.height; 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.mask.on('mousedown',_.bind(this.onUpdateFocus, this));
this.$window.on('mousedown',_.bind(this.onUpdateFocus, this)); this.$window.on('mousedown',_.bind(this.onUpdateFocus, this));
if (this.cmbFuncGroup.getValue() == 0) group && this.cmbFuncGroup.setValue(group);
this.fillFunctions('Last10'); (group || this.cmbFuncGroup.getValue()=='Last10') && this.fillFunctions(this.cmbFuncGroup.getValue());
if (this.cmbListFunctions) { if (this.cmbListFunctions) {
_.delay(function (me) { _.delay(function (me) {
@ -169,9 +169,7 @@ define([
}, },
onSelectGroup: function (combo, record) { onSelectGroup: function (combo, record) {
if (!_.isUndefined(record) && !_.isUndefined(record.value)) { if (!_.isUndefined(record) && !_.isUndefined(record.value)) {
if (record.value < this.formulasGroups.length) { record.value && this.fillFunctions(record.value);
this.fillFunctions(this.formulasGroups.at(record.value).get('name'));
}
} }
this.onUpdateFocus(); this.onUpdateFocus();
@ -213,7 +211,7 @@ define([
var group = this.formulasGroups.at(i); var group = this.formulasGroups.at(i);
if (group.get('functions').length) { if (group.get('functions').length) {
groupsListItems.push({ groupsListItems.push({
value : group.get('index'), value : group.get('name'),
displayValue : group.get('caption') displayValue : group.get('caption')
}); });
} }
@ -232,7 +230,7 @@ define([
} else { } else {
this.cmbFuncGroup.setData(groupsListItems); this.cmbFuncGroup.setData(groupsListItems);
} }
this.cmbFuncGroup.setValue(0); this.cmbFuncGroup.setValue('Last10');
this.fillFunctions('Last10'); this.fillFunctions('Last10');
} }

View file

@ -281,7 +281,7 @@ define([
items: arr items: arr
})); }));
btn.menu.on('item:click', function (menu, item, e) { 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) { 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); morearr.push(mnu);
} }