modal add button before specific

This commit is contained in:
yuri
2019-02-22 11:53:20 +02:00
parent 8d4ae8950a
commit bf08bddec3
2 changed files with 14 additions and 6 deletions
@@ -41,7 +41,7 @@ define('crm:views/meeting/modals/detail', 'views/modals/detail', function (Dep)
pullLeft: false,
hidden: this.hasAcceptanceStatusButton(),
style: buttonData.style,
}, false);
}, 'cancel');
this.initAcceptenceStatus();
this.on('switch-model', function (model, previousModel) {
+13 -5
View File
@@ -207,17 +207,25 @@ Espo.define('views/modal', 'view', function (Dep) {
this.$el.find('footer button[data-name="'+name+'"]').removeClass('disabled').removeAttr('disabled');
},
addButton: function (o, toBeginnig, doNotReRender) {
addButton: function (o, position, doNotReRender) {
var index = -1;
this.buttonList.forEach(function (item, i) {
if (item.name === o.name) {
index = i;
}
if (item.name === o.name) index = i;
}, this);
if (~index) return;
if (toBeginnig) {
if (position === true) {
this.buttonList.unshift(o);
} else if (typeof position === 'string') {
index = -1;
this.buttonList.forEach(function (item, i) {
if (item.name === position) index = i;
}, this);
if (~index) {
this.buttonList.splice(index, 0, o);
} else {
this.buttonList.push(o);
}
} else {
this.buttonList.push(o);
}