diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index e2ef7b06b..afa184f43 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -1487,7 +1487,7 @@ define([ langId: value, handler: function (result, settings) { if (me && me.api && result=='ok') { - me.api.asc_setCF(settings); + me.api.asc_setCF(settings.rules, settings.deleted); } } })).show(); diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js index 325c418b0..12fb58c0f 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesManagerDlg.js @@ -109,8 +109,9 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa this.props = options.props; this.langId = options.langId; this.rules = []; - - this.rulesStore = new Common.UI.DataViewStore(); + this.rulesStores = {}; + this.rulesDeleted = []; + this.listSettings = {length: 0, min: 0, max: 0}; Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); }, @@ -191,22 +192,22 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa _setDefaults: function (props) { this.rulesList.on('item:add', _.bind(this.addControls, this)); this.rulesList.on('item:change', _.bind(this.addControls, this)); + this.currentSheet = this.api.asc_getActiveWorksheetIndex(); this.refreshScopeList(); this.refreshRuleList(this.cmbScope.getSelectedRecord()); }, refreshScopeList: function() { - var wc = this.api.asc_getWorksheetsCount(), i = -1, - currentSheet = this.api.asc_getActiveWorksheetIndex(); + var wc = this.api.asc_getWorksheetsCount(), i = -1; var items = [ - { value: Asc.c_oAscSelectionForCFType.selection, displayValue: this.textSelection }, - { value: Asc.c_oAscSelectionForCFType.worksheet, displayValue: this.textThisSheet, sheetIndex: currentSheet }, - { value: Asc.c_oAscSelectionForCFType.table, displayValue: this.textThisTable }, - { value: Asc.c_oAscSelectionForCFType.pivot, displayValue: this.textThisPivot } + { value: Asc.c_oAscSelectionForCFType.selection, displayValue: this.textSelection, sheetIndex: -1 }, + { value: Asc.c_oAscSelectionForCFType.worksheet, displayValue: this.textThisSheet, sheetIndex: -1 }, + { value: Asc.c_oAscSelectionForCFType.table, displayValue: this.textThisTable, sheetIndex: -1 }, + { value: Asc.c_oAscSelectionForCFType.pivot, displayValue: this.textThisPivot, sheetIndex: -1 } ]; if (wc>1) { while (++i < wc) { - if (!this.api.asc_isWorksheetHidden(i) && i!==currentSheet) { + if (!this.api.asc_isWorksheetHidden(i) && i!==this.currentSheet) { items.push({ displayValue:this.api.asc_getWorksheetName(i), value: Asc.c_oAscSelectionForCFType.worksheet, @@ -221,30 +222,48 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa refreshRuleList: function(scope) { this.rules = []; - - var obj = this.api.asc_getCF(scope.value, (scope.value==Asc.c_oAscSelectionForCFType.worksheet) ? scope.sheetIndex : undefined); - var rules = obj[0]; - this.currentRange = obj[1]; - var arr = []; - if (rules) { - for (var i=0; i0) && this.rulesList.selectByIndex(0); + var sheetIndex = (scope.sheetIndex>-1) ? scope.sheetIndex : this.currentSheet; + var ruleStore = this.rulesStores[sheetIndex]; + if (!ruleStore) { + ruleStore = new Common.UI.DataViewStore(); + this.rulesStores[sheetIndex] = ruleStore; + + var obj = this.api.asc_getCF(Asc.c_oAscSelectionForCFType.worksheet, sheetIndex); + var rules = obj[0]; + this.currentRange = obj[1]; + var arr = []; + if (rules) { + for (var i=0; i