diff --git a/apps/common/main/lib/component/ComboDataView.js b/apps/common/main/lib/component/ComboDataView.js index ff31ae0aa..7c0d31c99 100644 --- a/apps/common/main/lib/component/ComboDataView.js +++ b/apps/common/main/lib/component/ComboDataView.js @@ -459,6 +459,13 @@ define([ this.menuPicker.selectByIndex(index); }, + selectRecord: function(record) { + if (!record) + this.fieldPicker.deselectAll(); + + this.menuPicker.selectRecord(record); + }, + setItemWidth: function(width) { if (this.itemWidth != width) this.itemWidth = window.devicePixelRatio > 1 ? width / 2 : width; diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 19217ebe6..0f3b3926f 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -1739,6 +1739,7 @@ define([ return; } + var rec = listStyles.menuPicker.getSelectedRec(); listStyles.menuPicker.store.reset([]); // remove all var mainController = this.getApplication().getController('Main'); @@ -1752,8 +1753,9 @@ define([ }); if (listStyles.menuPicker.store.length > 0 && listStyles.rendered) { - listStyles.fillComboView(listStyles.menuPicker.store.at(0), true); - listStyles.selectByIndex(0); + rec = rec ? listStyles.menuPicker.store.findWhere({name: rec.get('name')}) : null; + listStyles.fillComboView(rec ? rec : listStyles.menuPicker.store.at(0), true); + rec ? listStyles.selectRecord(rec) : listStyles.selectByIndex(0); } window.styles_loaded = true;