[SSE] Fix Bug 51272

This commit is contained in:
Julia Radzhabova 2021-07-14 16:25:30 +03:00
parent a10de0fa52
commit 6c4fe8984f

View file

@ -674,11 +674,13 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa
rec = this.rulesList.getSelectedRec();
if (rec) {
var index = store.indexOf(rec);
var newrec = store.at(up ? this.getPrevRuleIndex(index) : this.getNextRuleIndex(index)),
var newindex = up ? this.getPrevRuleIndex(index) : this.getNextRuleIndex(index),
newrec = store.at(newindex),
prioritynew = newrec.get('priority');
newrec.set('priority', rec.get('priority'));
rec.set('priority', prioritynew);
store.add(store.remove(rec), {at: up ? Math.max(0, index-1) : Math.min(length-1, index+1)});
store.add(store.remove(rec), {at: up ? Math.max(0, newindex) : Math.min(length-1, newindex)});
store.add(store.remove(newrec), {at: up ? Math.max(0, index) : Math.min(length-1, index)});
this.rulesList.selectRecord(rec);
this.rulesList.scrollToRecord(rec);
}