[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', cls : 'btn-large-dataview template-table',
iconCls : 'icon-template-table', iconCls : 'icon-template-table',
menu : new Common.UI.Menu({ menu : new Common.UI.Menu({
style: 'width: 575px;height: 478px;', style: 'width: 575px;',
items: [ items: [
{ template: _.template('<div id="id-table-menu-template" class="menu-table-template" style="margin: 5px 5px 5px 10px;"></div>') } { 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({ self.mnuTableTemplatePicker = new Common.UI.DataView({
el: $('#id-table-menu-template'), el: $('#id-table-menu-template'),
parentMenu: btn.menu, parentMenu: btn.menu,
restoreHeight: 421, restoreHeight: 350,
groups: new Common.UI.DataViewGroupStore(), groups: new Common.UI.DataViewGroupStore(),
store: new Common.UI.DataViewStore(), 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')); this.btnTableTemplate.render($('#table-btn-template'));

View file

@ -38,7 +38,7 @@
</tr> </tr>
<tr> <tr>
<td colspan=2 class="padding-small"> <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> </td>
</tr> </tr>
<tr> <tr>

View file

@ -128,7 +128,7 @@ define([
this.fireEvent('editcomplete', this); this.fireEvent('editcomplete', this);
}, },
onTableTemplateSelect: function(combo, record){ onTableTemplateSelect: function(btn, picker, itemView, record){
if (this.api && !this._noApply) { if (this.api && !this._noApply) {
var properties = new Asc.CTableProp(); var properties = new Asc.CTableProp();
properties.put_TableStyle(record.get('templateId')); properties.put_TableStyle(record.get('templateId'));
@ -436,19 +436,18 @@ define([
//for table-template //for table-template
value = props.get_TableStyle(); value = props.get_TableStyle();
if (this._state.TemplateId!==value || this._isTemplatesChanged) { if (this._state.TemplateId!==value || this._isTemplatesChanged) {
this.cmbTableTemplate.suspendEvents(); var rec = this.mnuTableTemplatePicker.store.findWhere({
var rec = this.cmbTableTemplate.menuPicker.store.findWhere({
templateId: value templateId: value
}); });
this.cmbTableTemplate.menuPicker.selectRecord(rec); if (!rec) {
this.cmbTableTemplate.resumeEvents(); rec = this.mnuTableTemplatePicker.store.at(0);
if (this._isTemplatesChanged) {
if (rec)
this.cmbTableTemplate.fillComboView(this.cmbTableTemplate.menuPicker.getSelectedRec(),true);
else
this.cmbTableTemplate.fillComboView(this.cmbTableTemplate.menuPicker.store.at(0), true);
} }
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._state.TemplateId = value;
} }
this._isTemplatesChanged = false; this._isTemplatesChanged = false;
@ -660,29 +659,36 @@ define([
var self = this; var self = this;
this._isTemplatesChanged = true; this._isTemplatesChanged = true;
if (!this.cmbTableTemplate) { if (!this.btnTableTemplate) {
this.cmbTableTemplate = new Common.UI.ComboDataView({ this.btnTableTemplate = new Common.UI.Button({
itemWidth: 70, cls : 'btn-large-dataview template-table',
itemHeight: 50, iconCls : 'icon-template-table',
menuMaxHeight: 300, menu : new Common.UI.Menu({
enableKeyEvents: true, style: 'width: 575px;',
cls: 'combo-template' 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.btnTableTemplate.on('render:after', function(btn) {
this.cmbTableTemplate.openButton.menu.cmpEl.css({ self.mnuTableTemplatePicker = new Common.UI.DataView({
'min-width': 175, el: $('#id-table-menu-template'),
'max-width': 175 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) { if (count>0 && count==Templates.length) {
var data = self.cmbTableTemplate.menuPicker.store.models; var data = self.mnuTableTemplatePicker.store.models;
_.each(Templates, function(template, index){ _.each(Templates, function(template, index){
data[index].set('imageUrl', template.asc_getImage()); data[index].set('imageUrl', template.asc_getImage());
}); });
@ -705,7 +711,7 @@ define([
tip : tip tip : tip
}); });
}); });
self.cmbTableTemplate.menuPicker.store.reset(arr); self.mnuTableTemplatePicker.store.reset(arr);
} }
}, },

View file

@ -43,7 +43,7 @@
</tr> </tr>
<tr> <tr>
<td colspan=2 class="padding-small"> <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> </td>
</tr> </tr>
<tr> <tr>

View file

@ -100,7 +100,7 @@ define([
Common.NotificationCenter.trigger('edit:complete', this); Common.NotificationCenter.trigger('edit:complete', this);
}, },
onTableTemplateSelect: function(combo, record){ onTableTemplateSelect: function(btn, picker, itemView, record){
if (this.api && !this._noApply) { if (this.api && !this._noApply) {
this.api.asc_changeAutoFilter(this._state.TableName, Asc.c_oAscChangeFilterOptions.style, record.get('name')); this.api.asc_changeAutoFilter(this._state.TableName, Asc.c_oAscChangeFilterOptions.style, record.get('name'));
} }
@ -398,19 +398,18 @@ define([
//for table-template //for table-template
value = props.asc_getTableStyleName(); value = props.asc_getTableStyleName();
if (this._state.TemplateName!==value || this._isTemplatesChanged) { if (this._state.TemplateName!==value || this._isTemplatesChanged) {
this.cmbTableTemplate.suspendEvents(); var rec = this.mnuTableTemplatePicker.store.findWhere({
var rec = this.cmbTableTemplate.menuPicker.store.findWhere({
name: value name: value
}); });
this.cmbTableTemplate.menuPicker.selectRecord(rec); if (!rec) {
this.cmbTableTemplate.resumeEvents(); rec = this.mnuTableTemplatePicker.store.at(0);
if (this._isTemplatesChanged) {
if (rec)
this.cmbTableTemplate.fillComboView(this.cmbTableTemplate.menuPicker.getSelectedRec(),true);
else
this.cmbTableTemplate.fillComboView(this.cmbTableTemplate.menuPicker.store.at(0), true);
} }
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._state.TemplateName=value;
} }
this._isTemplatesChanged = false; this._isTemplatesChanged = false;
@ -429,29 +428,38 @@ define([
var self = this; var self = this;
this._isTemplatesChanged = true; this._isTemplatesChanged = true;
if (!this.cmbTableTemplate) { if (!this.btnTableTemplate) {
this.cmbTableTemplate = new Common.UI.ComboDataView({ this.btnTableTemplate = new Common.UI.Button({
itemWidth: 61, cls : 'btn-large-dataview template-table',
itemHeight: 46, iconCls : 'icon-template-table',
menuMaxHeight: 300, menu : new Common.UI.Menu({
enableKeyEvents: true 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.btnTableTemplate.on('render:after', function(btn) {
this.cmbTableTemplate.openButton.menu.cmpEl.css({ self.mnuTableTemplatePicker = new Common.UI.DataView({
'min-width': 175, el: $('#id-table-menu-template'),
'max-width': 175 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'));
if (this._locked) this.cmbTableTemplate.setDisabled(this._locked); 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) { if (count>0 && count==Templates.length) {
var data = self.cmbTableTemplate.menuPicker.store.models; var data = self.mnuTableTemplatePicker.store.models;
_.each(Templates, function(template, index){ _.each(Templates, function(template, index){
data[index].set('imageUrl', template.asc_getImage()); data[index].set('imageUrl', template.asc_getImage());
}); });
@ -469,7 +477,7 @@ define([
tip : template.asc_getDisplayName() tip : template.asc_getDisplayName()
}); });
}); });
self.cmbTableTemplate.menuPicker.store.reset(arr); self.mnuTableTemplatePicker.store.reset(arr);
} }
}, },