diff --git a/apps/common/main/lib/component/ComboDataView.js b/apps/common/main/lib/component/ComboDataView.js index c10d000ca..a667aac1f 100644 --- a/apps/common/main/lib/component/ComboDataView.js +++ b/apps/common/main/lib/component/ComboDataView.js @@ -414,10 +414,11 @@ define([ } } - me.fieldPicker.store.reset([]); // remove all + var indexRec = store.indexOf(record); + if (indexRec < 0) + return; - var indexRec = store.indexOf(record), - countRec = store.length, + var countRec = store.length, maxViewCount = Math.floor(Math.max(fieldPickerEl.width(), me.minWidth) / (me.itemWidth + (me.itemMarginLeft || 0) + (me.itemMarginRight || 0) + (me.itemPaddingLeft || 0) + (me.itemPaddingRight || 0) + (me.itemBorderLeft || 0) + (me.itemBorderRight || 0))), newStyles = []; @@ -425,9 +426,6 @@ define([ if (fieldPickerEl.height() / me.itemHeight > 2) maxViewCount *= Math.floor(fieldPickerEl.height() / me.itemHeight); - if (indexRec < 0) - return; - indexRec = Math.floor(indexRec / maxViewCount) * maxViewCount; if (countRec - indexRec < maxViewCount) indexRec = Math.max(countRec - maxViewCount, 0); @@ -435,7 +433,7 @@ define([ newStyles.push(store.at(index)); } - me.fieldPicker.store.add(newStyles); + me.fieldPicker.store.reset(newStyles); } if (forceSelect) { diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 98a05facc..c8bdca3d9 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -2681,17 +2681,17 @@ define([ return; } - listStyles.menuPicker.store.reset([]); // remove all - + var arr = []; var mainController = this.getApplication().getController('Main'); _.each(styles.get_MergedStyles(), function(style){ - listStyles.menuPicker.store.add({ + arr.push({ imageUrl: style.asc_getImage(), title : style.get_Name(), tip : mainController.translationTable[style.get_Name()] || style.get_Name(), id : Common.UI.getId() }); }); + listStyles.menuPicker.store.reset(arr); // remove all if (listStyles.menuPicker.store.length > 0 && listStyles.rendered){ var styleRec;