[DE] [SSE] [PE] Fix bug 42429

This commit is contained in:
Julia Svinareva 2019-12-13 17:18:11 +03:00
parent 050d1a697e
commit 7dd4e731d9
5 changed files with 82 additions and 67 deletions

View file

@ -697,7 +697,7 @@ define([
cls : 'btn-large-dataview template-table',
iconCls : 'icon-template-table',
menu : new Common.UI.Menu({
style: 'width: 575px;height: 478px;',
style: 'width: 575px;',
items: [
{ template: _.template('<div id="id-table-menu-template" class="menu-table-template" style="margin: 5px 5px 5px 10px;"></div>') }
]
@ -707,10 +707,11 @@ define([
self.mnuTableTemplatePicker = new Common.UI.DataView({
el: $('#id-table-menu-template'),
parentMenu: btn.menu,
restoreHeight: 421,
restoreHeight: 350,
groups: new Common.UI.DataViewGroupStore(),
store: new Common.UI.DataViewStore(),
itemTemplate: _.template('<div id="<%= id %>" class="item"><img src="<%= imageUrl %>" height="50" width="70"></div>')
itemTemplate: _.template('<div id="<%= id %>" class="item"><img src="<%= imageUrl %>" height="50" width="70"></div>'),
style: 'max-height: 350px;'
});
});
this.btnTableTemplate.render($('#table-btn-template'));

View file

@ -38,7 +38,7 @@
</tr>
<tr>
<td colspan=2 class="padding-small">
<div class="" id="table-combo-template" style="width: 100%; height: 64px;"></div>
<div class="" id="table-btn-template" style="width: 100%; height: 58px;"></div>
</td>
</tr>
<tr>

View file

@ -128,7 +128,7 @@ define([
this.fireEvent('editcomplete', this);
},
onTableTemplateSelect: function(combo, record){
onTableTemplateSelect: function(btn, picker, itemView, record){
if (this.api && !this._noApply) {
var properties = new Asc.CTableProp();
properties.put_TableStyle(record.get('templateId'));
@ -436,20 +436,19 @@ define([
//for table-template
value = props.get_TableStyle();
if (this._state.TemplateId!==value || this._isTemplatesChanged) {
this.cmbTableTemplate.suspendEvents();
var rec = this.cmbTableTemplate.menuPicker.store.findWhere({
var rec = this.mnuTableTemplatePicker.store.findWhere({
templateId: value
});
this.cmbTableTemplate.menuPicker.selectRecord(rec);
this.cmbTableTemplate.resumeEvents();
if (this._isTemplatesChanged) {
if (rec)
this.cmbTableTemplate.fillComboView(this.cmbTableTemplate.menuPicker.getSelectedRec(),true);
else
this.cmbTableTemplate.fillComboView(this.cmbTableTemplate.menuPicker.store.at(0), true);
if (!rec) {
rec = this.mnuTableTemplatePicker.store.at(0);
}
this._state.TemplateId=value;
this.btnTableTemplate.suspendEvents();
this.mnuTableTemplatePicker.selectRecord(rec, true);
this.btnTableTemplate.resumeEvents();
this.$el.find('.icon-template-table').css({'background-image': 'url(' + rec.get("imageUrl") + ')', 'height': '52px', 'width': '74px', 'background-position': 'center'});
this._state.TemplateId = value;
}
this._isTemplatesChanged = false;
@ -660,29 +659,36 @@ define([
var self = this;
this._isTemplatesChanged = true;
if (!this.cmbTableTemplate) {
this.cmbTableTemplate = new Common.UI.ComboDataView({
itemWidth: 70,
itemHeight: 50,
menuMaxHeight: 300,
enableKeyEvents: true,
cls: 'combo-template'
if (!this.btnTableTemplate) {
this.btnTableTemplate = new Common.UI.Button({
cls : 'btn-large-dataview template-table',
iconCls : 'icon-template-table',
menu : new Common.UI.Menu({
style: 'width: 575px;',
items: [
{ template: _.template('<div id="id-table-menu-template" class="menu-table-template" style="margin: 5px 5px 5px 10px;"></div>') }
]
})
});
this.cmbTableTemplate.render($('#table-combo-template'));
this.cmbTableTemplate.openButton.menu.cmpEl.css({
'min-width': 175,
'max-width': 175
this.btnTableTemplate.on('render:after', function(btn) {
self.mnuTableTemplatePicker = new Common.UI.DataView({
el: $('#id-table-menu-template'),
parentMenu: btn.menu,
restoreHeight: 350,
groups: new Common.UI.DataViewGroupStore(),
store: new Common.UI.DataViewStore(),
itemTemplate: _.template('<div id="<%= id %>" class="item"><img src="<%= imageUrl %>" height="50" width="70"></div>'),
style: 'max-height: 350px;'
});
});
this.cmbTableTemplate.on('click', _.bind(this.onTableTemplateSelect, this));
this.cmbTableTemplate.openButton.menu.on('show:after', function () {
self.cmbTableTemplate.menuPicker.scroller.update({alwaysVisibleY: true});
});
this.lockedControls.push(this.cmbTableTemplate);
this.btnTableTemplate.render($('#table-btn-template'));
this.lockedControls.push(this.btnTableTemplate);
this.mnuTableTemplatePicker.on('item:click', _.bind(this.onTableTemplateSelect, this, this.btnTableTemplate));
}
var count = self.cmbTableTemplate.menuPicker.store.length;
var count = self.mnuTableTemplatePicker.store.length;
if (count>0 && count==Templates.length) {
var data = self.cmbTableTemplate.menuPicker.store.models;
var data = self.mnuTableTemplatePicker.store.models;
_.each(Templates, function(template, index){
data[index].set('imageUrl', template.asc_getImage());
});
@ -705,7 +711,7 @@ define([
tip : tip
});
});
self.cmbTableTemplate.menuPicker.store.reset(arr);
self.mnuTableTemplatePicker.store.reset(arr);
}
},

View file

@ -43,7 +43,7 @@
</tr>
<tr>
<td colspan=2 class="padding-small">
<div class="" id="table-combo-template" style="width: 100%; height: 60px;"></div>
<div class="" id="table-btn-template" style="width: 100%; height: 58px;"></div>
</td>
</tr>
<tr>

View file

@ -100,7 +100,7 @@ define([
Common.NotificationCenter.trigger('edit:complete', this);
},
onTableTemplateSelect: function(combo, record){
onTableTemplateSelect: function(btn, picker, itemView, record){
if (this.api && !this._noApply) {
this.api.asc_changeAutoFilter(this._state.TableName, Asc.c_oAscChangeFilterOptions.style, record.get('name'));
}
@ -398,19 +398,18 @@ define([
//for table-template
value = props.asc_getTableStyleName();
if (this._state.TemplateName!==value || this._isTemplatesChanged) {
this.cmbTableTemplate.suspendEvents();
var rec = this.cmbTableTemplate.menuPicker.store.findWhere({
var rec = this.mnuTableTemplatePicker.store.findWhere({
name: value
});
this.cmbTableTemplate.menuPicker.selectRecord(rec);
this.cmbTableTemplate.resumeEvents();
if (this._isTemplatesChanged) {
if (rec)
this.cmbTableTemplate.fillComboView(this.cmbTableTemplate.menuPicker.getSelectedRec(),true);
else
this.cmbTableTemplate.fillComboView(this.cmbTableTemplate.menuPicker.store.at(0), true);
if (!rec) {
rec = this.mnuTableTemplatePicker.store.at(0);
}
this.btnTableTemplate.suspendEvents();
this.mnuTableTemplatePicker.selectRecord(rec, true);
this.btnTableTemplate.resumeEvents();
this.$el.find('.icon-template-table').css({'background-image': 'url(' + rec.get("imageUrl") + ')', 'height': '52px', 'width': '71px', 'background-position': 'center'});
this._state.TemplateName=value;
}
this._isTemplatesChanged = false;
@ -429,29 +428,38 @@ define([
var self = this;
this._isTemplatesChanged = true;
if (!this.cmbTableTemplate) {
this.cmbTableTemplate = new Common.UI.ComboDataView({
itemWidth: 61,
itemHeight: 46,
menuMaxHeight: 300,
enableKeyEvents: true
if (!this.btnTableTemplate) {
this.btnTableTemplate = new Common.UI.Button({
cls : 'btn-large-dataview template-table',
iconCls : 'icon-template-table',
menu : new Common.UI.Menu({
style: 'width: 575px;',
items: [
{ template: _.template('<div id="id-table-menu-template" class="menu-table-template" style="margin: 5px 5px 5px 10px;"></div>') }
]
})
});
this.cmbTableTemplate.render($('#table-combo-template'));
this.cmbTableTemplate.openButton.menu.cmpEl.css({
'min-width': 175,
'max-width': 175
this.btnTableTemplate.on('render:after', function(btn) {
self.mnuTableTemplatePicker = new Common.UI.DataView({
el: $('#id-table-menu-template'),
parentMenu: btn.menu,
restoreHeight: 350,
groups: new Common.UI.DataViewGroupStore(),
store: new Common.UI.DataViewStore(),
itemTemplate: _.template('<div id="<%= id %>" class="item"><img src="<%= imageUrl %>" height="50" width="70"></div>'),
style: 'max-height: 350px;'
});
});
this.cmbTableTemplate.on('click', _.bind(this.onTableTemplateSelect, this));
this.cmbTableTemplate.openButton.menu.on('show:after', function () {
self.cmbTableTemplate.menuPicker.scroller.update({alwaysVisibleY: true});
});
this.lockedControls.push(this.cmbTableTemplate);
if (this._locked) this.cmbTableTemplate.setDisabled(this._locked);
this.btnTableTemplate.render($('#table-btn-template'));
this.lockedControls.push(this.btnTableTemplate);
this.mnuTableTemplatePicker.on('item:click', _.bind(this.onTableTemplateSelect, this, this.btnTableTemplate));
if (this._locked) this.btnTableTemplate.setDisabled(this._locked);
}
var count = self.cmbTableTemplate.menuPicker.store.length;
var count = self.mnuTableTemplatePicker.store.length;
if (count>0 && count==Templates.length) {
var data = self.cmbTableTemplate.menuPicker.store.models;
var data = self.mnuTableTemplatePicker.store.models;
_.each(Templates, function(template, index){
data[index].set('imageUrl', template.asc_getImage());
});
@ -469,7 +477,7 @@ define([
tip : template.asc_getDisplayName()
});
});
self.cmbTableTemplate.menuPicker.store.reset(arr);
self.mnuTableTemplatePicker.store.reset(arr);
}
},