[SSE] Optimize styles update
This commit is contained in:
parent
1216bae9bd
commit
791e967609
|
@ -459,6 +459,13 @@ define([
|
||||||
this.menuPicker.selectByIndex(index);
|
this.menuPicker.selectByIndex(index);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
selectRecord: function(record) {
|
||||||
|
if (!record)
|
||||||
|
this.fieldPicker.deselectAll();
|
||||||
|
|
||||||
|
this.menuPicker.selectRecord(record);
|
||||||
|
},
|
||||||
|
|
||||||
setItemWidth: function(width) {
|
setItemWidth: function(width) {
|
||||||
if (this.itemWidth != width)
|
if (this.itemWidth != width)
|
||||||
this.itemWidth = window.devicePixelRatio > 1 ? width / 2 : width;
|
this.itemWidth = window.devicePixelRatio > 1 ? width / 2 : width;
|
||||||
|
|
|
@ -1739,23 +1739,37 @@ define([
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
listStyles.menuPicker.store.reset([]); // remove all
|
|
||||||
|
|
||||||
var mainController = this.getApplication().getController('Main');
|
var mainController = this.getApplication().getController('Main');
|
||||||
_.each(styles, function(style){
|
var count = listStyles.menuPicker.store.length;
|
||||||
listStyles.menuPicker.store.add({
|
var rec;
|
||||||
imageUrl: style.asc_getImage(),
|
if (count>0 && count==styles.length) {
|
||||||
name : style.asc_getName(),
|
rec = listStyles.menuPicker.getSelectedRec();
|
||||||
tip : mainController.translationTable[style.get_Name()] || style.get_Name(),
|
var data = listStyles.menuPicker.dataViewItems;
|
||||||
uid : Common.UI.getId()
|
data && _.each(styles, function(style, index){
|
||||||
|
var img = style.asc_getImage();
|
||||||
|
data[index].model.set('imageUrl', img, {silent: true});
|
||||||
|
data[index].model.set({
|
||||||
|
name : style.asc_getName(),
|
||||||
|
tip : mainController.translationTable[style.get_Name()] || style.get_Name()
|
||||||
|
});
|
||||||
|
$(data[index].el).find('img').attr('src', img);
|
||||||
});
|
});
|
||||||
});
|
} else {
|
||||||
|
var arr = [];
|
||||||
if (listStyles.menuPicker.store.length > 0 && listStyles.rendered) {
|
_.each(styles, function(style){
|
||||||
listStyles.fillComboView(listStyles.menuPicker.store.at(0), true);
|
arr.push({
|
||||||
listStyles.selectByIndex(0);
|
imageUrl: style.asc_getImage(),
|
||||||
|
name : style.asc_getName(),
|
||||||
|
tip : mainController.translationTable[style.get_Name()] || style.get_Name(),
|
||||||
|
uid : Common.UI.getId()
|
||||||
|
});
|
||||||
|
});
|
||||||
|
listStyles.menuPicker.store.reset(arr);
|
||||||
|
}
|
||||||
|
if (listStyles.menuPicker.store.length > 0 && listStyles.rendered) {
|
||||||
|
listStyles.fillComboView(rec ? rec : listStyles.menuPicker.store.at(0), true, true);
|
||||||
|
rec ? listStyles.selectRecord(rec) : listStyles.selectByIndex(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.styles_loaded = true;
|
window.styles_loaded = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue