[DE] Draw chart style when it's received
This commit is contained in:
parent
7ba1009581
commit
15977a76e1
|
@ -425,30 +425,34 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
selectCurrentChartStyle: function() {
|
selectCurrentChartStyle: function() {
|
||||||
if (!this.cmbChartStyle || this._state.beginPreviewStyles || this._state.previewStylesCount!==this.cmbChartStyle.menuPicker.store.length) return;
|
if (!this.cmbChartStyle || this._state.beginPreviewStyles) return;
|
||||||
|
|
||||||
this.cmbChartStyle.suspendEvents();
|
this.cmbChartStyle.suspendEvents();
|
||||||
var rec = this.cmbChartStyle.menuPicker.store.findWhere({data: this._state.ChartStyle});
|
var rec = this.cmbChartStyle.menuPicker.store.findWhere({data: this._state.ChartStyle});
|
||||||
if (!rec) {
|
if (!rec && (this._state.previewStylesCount===this.cmbChartStyle.menuPicker.store.length || this._state.drawCurrentStyle)) {
|
||||||
rec = this.cmbChartStyle.menuPicker.store.at(0);
|
rec = this.cmbChartStyle.menuPicker.store.at(0);
|
||||||
}
|
}
|
||||||
this.cmbChartStyle.menuPicker.selectRecord(rec);
|
this.cmbChartStyle.menuPicker.selectRecord(rec);
|
||||||
this.cmbChartStyle.resumeEvents();
|
this.cmbChartStyle.resumeEvents();
|
||||||
|
|
||||||
rec && this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.getSelectedRec(), true);
|
if (rec) {
|
||||||
this._state.currentStyleFound = true;
|
this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.getSelectedRec(), true);
|
||||||
|
this._state.currentStyleFound = true;
|
||||||
|
this._state.drawCurrentStyle = false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onBeginChartStylesPreview: function(count){
|
onBeginChartStylesPreview: function(count){
|
||||||
this._state.beginPreviewStyles = true;
|
this._state.beginPreviewStyles = true;
|
||||||
this._state.currentStyleFound = false;
|
this._state.currentStyleFound = false;
|
||||||
|
this._state.drawCurrentStyle = false;
|
||||||
this._state.previewStylesCount = count;
|
this._state.previewStylesCount = count;
|
||||||
},
|
},
|
||||||
|
|
||||||
onEndChartStylesPreview: function(){
|
onEndChartStylesPreview: function(){
|
||||||
if (this.cmbChartStyle) {
|
if (this.cmbChartStyle) {
|
||||||
if (this.cmbChartStyle.menuPicker.store.length>0) {
|
if (this.cmbChartStyle.menuPicker.store.length>0) {
|
||||||
this.selectCurrentChartStyle();
|
!this._state.currentStyleFound && this.selectCurrentChartStyle();
|
||||||
this.cmbChartStyle.menuPicker.scroller.update({alwaysVisibleY: true});
|
this.cmbChartStyle.menuPicker.scroller.update({alwaysVisibleY: true});
|
||||||
} else {
|
} else {
|
||||||
this.cmbChartStyle.menuPicker.store.reset();
|
this.cmbChartStyle.menuPicker.store.reset();
|
||||||
|
@ -465,18 +469,25 @@ define([
|
||||||
if (stylesStore) {
|
if (stylesStore) {
|
||||||
var stylearray = [];
|
var stylearray = [];
|
||||||
_.each(styles, function(item, index){
|
_.each(styles, function(item, index){
|
||||||
|
var name = item.asc_getName();
|
||||||
stylearray.push({
|
stylearray.push({
|
||||||
imageUrl: item.asc_getImage(),
|
imageUrl: item.asc_getImage(),
|
||||||
data : item.asc_getName(),
|
data : name,
|
||||||
tip : me.textStyle + ' ' + item.asc_getName()
|
tip : me.textStyle + ' ' + item.asc_getName()
|
||||||
});
|
});
|
||||||
|
if (name===me._state.ChartStyle)
|
||||||
|
me._state.drawCurrentStyle = true;
|
||||||
});
|
});
|
||||||
if (this._state.beginPreviewStyles) {
|
if (this._state.beginPreviewStyles) {
|
||||||
this._state.beginPreviewStyles = false;
|
this._state.beginPreviewStyles = false;
|
||||||
stylesStore.reset(stylearray);
|
stylesStore.reset(stylearray);
|
||||||
} else
|
if (this._state.ChartStyle===null)
|
||||||
|
this._state.drawCurrentStyle = true;
|
||||||
|
} else {
|
||||||
stylesStore.add(stylearray);
|
stylesStore.add(stylearray);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
!this._state.currentStyleFound && this._state.drawCurrentStyle && (stylesStore.length>2) && this.selectCurrentChartStyle();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue