[SSE] Optimize loading of formulas
This commit is contained in:
parent
66b9884086
commit
e25baee4cc
|
@ -286,6 +286,7 @@ define([
|
|||
if ( $tp.length ) {
|
||||
$tp.addClass('active');
|
||||
}
|
||||
this.fireEvent('tab:active', [tab]);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -83,7 +83,8 @@ define([
|
|||
'function:apply': this.applyFunction
|
||||
},
|
||||
'Toolbar': {
|
||||
'function:apply': this.applyFunction
|
||||
'function:apply': this.applyFunction,
|
||||
'tab:active': this.onTabActive
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -114,7 +115,7 @@ define([
|
|||
if (this.formulasGroups && this.api) {
|
||||
Common.Utils.InternalSettings.set("sse-settings-func-last", Common.localStorage.getItem("sse-settings-func-last"));
|
||||
|
||||
this.reloadTranslations(Common.localStorage.getItem("sse-settings-func-locale") || this.appOptions.lang );
|
||||
this.reloadTranslations(Common.localStorage.getItem("sse-settings-func-locale") || this.appOptions.lang, true);
|
||||
|
||||
var me = this;
|
||||
|
||||
|
@ -155,7 +156,7 @@ define([
|
|||
this.appOptions.lang = data.config.lang;
|
||||
},
|
||||
|
||||
reloadTranslations: function (lang) {
|
||||
reloadTranslations: function (lang, suppressEvent) {
|
||||
var me = this;
|
||||
lang = (lang || 'en').split(/[\-_]/)[0].toLowerCase();
|
||||
|
||||
|
@ -178,18 +179,18 @@ define([
|
|||
}
|
||||
|
||||
if (me.langDescJson[lang])
|
||||
me.loadingFormulas(me.langDescJson[lang]);
|
||||
me.loadingFormulas(me.langDescJson[lang], suppressEvent);
|
||||
else {
|
||||
Common.Utils.loadConfig('resources/formula-lang/' + lang + '_desc.json',
|
||||
function (config) {
|
||||
if ( config != 'error' ) {
|
||||
me.langDescJson[lang] = config;
|
||||
me.loadingFormulas(config);
|
||||
me.loadingFormulas(config, suppressEvent);
|
||||
} else {
|
||||
Common.Utils.loadConfig('resources/formula-lang/en_desc.json',
|
||||
function (config) {
|
||||
me.langDescJson[lang] = (config != 'error') ? config : null;
|
||||
me.loadingFormulas(me.langDescJson[lang]);
|
||||
me.loadingFormulas(me.langDescJson[lang], suppressEvent);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -258,7 +259,7 @@ define([
|
|||
return functions;
|
||||
},
|
||||
|
||||
loadingFormulas: function (descrarr) {
|
||||
loadingFormulas: function (descrarr, suppressEvent) {
|
||||
var i = 0, j = 0,
|
||||
ascGroupName,
|
||||
ascFunctions,
|
||||
|
@ -342,8 +343,16 @@ define([
|
|||
_.sortBy(allFunctions, function (model) {return model.get('name'); }));
|
||||
}
|
||||
}
|
||||
this.formulaTab && this.formulaTab.fillFunctions();
|
||||
!suppressEvent && this.formulaTab && this.formulaTab.fillFunctions();
|
||||
},
|
||||
|
||||
onTabActive: function (tab) {
|
||||
if ( tab == 'formula' && !this._formulasInited && this.formulaTab) {
|
||||
this.formulaTab.fillFunctions();
|
||||
this._formulasInited = true;
|
||||
}
|
||||
},
|
||||
|
||||
sCategoryAll: 'All',
|
||||
sCategoryLast10: '10 last used',
|
||||
sCategoryLogical: 'Logical',
|
||||
|
|
Loading…
Reference in a new issue