fix list view

This commit is contained in:
yuri
2018-06-25 14:29:39 +03:00
parent 78390efe45
commit cabef5906c
+29 -21
View File
@@ -143,26 +143,7 @@ Espo.define('views/record/list', 'view', function (Dep) {
}
},
'click .select-all': function (e) {
this.checkedList = [];
if (e.currentTarget.checked) {
this.$el.find('input.record-checkbox').prop('checked', true);
this.$el.find('.actions-button').removeAttr('disabled');
this.collection.models.forEach(function (model) {
this.checkedList.push(model.id);
}, this);
this.$el.find('.list > table tbody tr').addClass('active');
} else {
if (this.allResultIsChecked) {
this.unselectAllResult();
}
this.$el.find('input.record-checkbox').prop('checked', false);
this.$el.find('.actions-button').attr('disabled', true);
this.$el.find('.list > table tbody tr').removeClass('active');
}
this.trigger('check');
this.selectAllHandler(e.currentTarget.checked);
},
'click .action': function (e) {
var $el = $(e.currentTarget);
@@ -190,6 +171,30 @@ Espo.define('views/record/list', 'view', function (Dep) {
}
},
selectAllHandler: function (isChecked) {
this.checkedList = [];
var $actionsButton = this.$el.find('.actions-button');
if (isChecked) {
this.$el.find('input.record-checkbox').prop('checked', true);
$actionsButton.removeAttr('disabled');
this.collection.models.forEach(function (model) {
this.checkedList.push(model.id);
}, this);
this.$el.find('.list > table tbody tr').addClass('active');
} else {
if (this.allResultIsChecked) {
this.unselectAllResult();
}
this.$el.find('input.record-checkbox').prop('checked', false);
$actionsButton.attr('disabled', true);
this.$el.find('.list > table tbody tr').removeClass('active');
}
this.trigger('check');
},
/**
* @param {string} or {bool} ['both', 'top', 'bottom', false, true] Where to display paginations.
*/
@@ -304,7 +309,10 @@ Espo.define('views/record/list', 'view', function (Dep) {
}
}, this);
this.$el.find('.actions-button').removeAttr('disabled');
if (this.checkAllResultMassActionList.length) {
this.$el.find('.actions-button').removeAttr('disabled');
}
this.$el.find('.list > table tbody tr').removeClass('active');
},