From 3fd34fc48d7db38e06359a2ceef22dbc0f166627 Mon Sep 17 00:00:00 2001 From: yuri Date: Mon, 25 Apr 2016 15:28:39 +0300 Subject: [PATCH] show more after remove issue fix --- client/src/views/record/detail.js | 20 ++++++++++++++------ client/src/views/record/list.js | 4 +--- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/client/src/views/record/detail.js b/client/src/views/record/detail.js index d898612b63..f1b6ec36a4 100644 --- a/client/src/views/record/detail.js +++ b/client/src/views/record/detail.js @@ -397,17 +397,25 @@ Espo.define('views/record/detail', ['views/record/base', 'view-record-helper'], this.notify('Removing...'); + var collection = this.model.collection; + var self = this; this.model.destroy({ wait: true, error: function () { - self.notify('Error occured!', 'error'); - }, + this.notify('Error occured!', 'error'); + }.bind(this), success: function () { - self.notify('Removed', 'success'); - self.trigger('after:delete'); - self.exit('delete'); - }, + if (collection) { + if (collection.total > 0) { + collection.total--; + } + } + + this.notify('Removed', 'success'); + this.trigger('after:delete'); + this.exit('delete'); + }.bind(this), }); } }, diff --git a/client/src/views/record/list.js b/client/src/views/record/list.js index 9d3140c9fb..a32550d6ac 100644 --- a/client/src/views/record/list.js +++ b/client/src/views/record/list.js @@ -216,6 +216,7 @@ Espo.define('views/record/list', 'view', function (Dep) { allResultIsChecked: false, data: function () { + var paginationTop = this.pagination === 'both' || this.pagination === true || this.pagination === 'top'; var paginationBottom = this.pagination === 'both' || this.pagination === true || this.pagination === 'bottom'; return { @@ -368,9 +369,6 @@ Espo.define('views/record/list', 'view', function (Dep) { } } else { var idsRemoved = result.ids || []; - if (this.collection.total > 0) { - this.collection.total = this.collection.total - count; - } if (count) { idsRemoved.forEach(function (id) { Espo.Ui.notify(false);