pagination fixes
This commit is contained in:
@@ -1,18 +1,22 @@
|
||||
|
||||
<ul class="pagination">
|
||||
<li {{#unless previous}}class="disabled"{{/unless}}>
|
||||
<a href="javascript:" data-page="first"><i class="fas fa-fast-backward"></i></a>
|
||||
<a class="pagination-btn" href="javascript:" data-page="first"><i class="fas fa-fast-backward"></i></a>
|
||||
</li>
|
||||
<li {{#unless previous}}class="disabled"{{/unless}}>
|
||||
<a href="javascript:" data-page="previous"><i class="fas fa-backward"></i></a>
|
||||
<a class="pagination-btn" href="javascript:" data-page="previous"><i class="fas fa-backward"></i></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:" data-page="current">{{from}} - {{to}} {{translate 'of'}} {{total}}</a>
|
||||
<a
|
||||
class="pagination-btn-middle"
|
||||
href="javascript:"
|
||||
data-page="current"
|
||||
>{{from}} - {{to}}{{#unless noTotal}} {{translate 'of'}} {{total}}{{/unless}}</a>
|
||||
</li>
|
||||
<li {{#unless next}}class="disabled"{{/unless}}>
|
||||
<a href="javascript:" data-page="next"><i class="fas fa-forward"></i></a>
|
||||
<a class="pagination-btn" href="javascript:" data-page="next"><i class="fas fa-forward"></i></a>
|
||||
</li>
|
||||
<li {{#unless next}}class="disabled"{{/unless}}>
|
||||
<a href="javascript:" data-page="last"><i class="fas fa-fast-forward"></i></a>
|
||||
<a class="pagination-btn" href="javascript:" data-page="last"><i class="fas fa-fast-forward"></i></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -123,6 +123,10 @@ define('collection', [], function () {
|
||||
lastPage: function () {
|
||||
let offset = this.total - this.total % this.maxSize;
|
||||
|
||||
if (offset === this.total) {
|
||||
offset = this.total - this.maxSize;
|
||||
}
|
||||
|
||||
this.setOffset(offset);
|
||||
},
|
||||
|
||||
@@ -131,7 +135,7 @@ define('collection', [], function () {
|
||||
throw new RangeError('offset can not be less than 0');
|
||||
}
|
||||
|
||||
if (offset > this.total) {
|
||||
if (offset > this.total && this.total !== -1 && offset > 0) {
|
||||
throw new RangeError('offset can not be larger than total count');
|
||||
}
|
||||
|
||||
|
||||
@@ -362,6 +362,13 @@ define('views/list', ['views/main', 'search-manager'], function (Dep, SearchMana
|
||||
o.keepCurrentRootUrl = true;
|
||||
}
|
||||
|
||||
if (
|
||||
this.getConfig().get('listPagination') ||
|
||||
this.getMetadata().get(['clientDefs', this.scope, 'listPagination'])
|
||||
) {
|
||||
o.pagination = true;
|
||||
}
|
||||
|
||||
this.prepareRecordViewOptions(o);
|
||||
|
||||
var listViewName = this.getRecordViewName();
|
||||
|
||||
@@ -321,6 +321,9 @@ define('views/modals/related-list', ['views/modal', 'search-manager'], function
|
||||
rowActionsOptions: {
|
||||
unlinkDisabled: this.unlinkDisabled,
|
||||
},
|
||||
pagination: this.getConfig().get('listPagination') ||
|
||||
this.getMetadata().get(['clientDefs', this.scope, 'listPagination']) ||
|
||||
null,
|
||||
}, function (view) {
|
||||
this.listenToOnce(view, 'select', function (model) {
|
||||
this.trigger('select', model);
|
||||
|
||||
@@ -34,7 +34,8 @@ define('views/record/list-pagination', 'view', function (Dep) {
|
||||
|
||||
data: function () {
|
||||
var previous = this.collection.offset > 0;
|
||||
var next = this.collection.total - this.collection.offset > this.collection.maxSize;
|
||||
var next = this.collection.total - this.collection.offset > this.collection.maxSize ||
|
||||
this.collection.total === -1;
|
||||
|
||||
return {
|
||||
total: this.collection.total,
|
||||
@@ -42,8 +43,9 @@ define('views/record/list-pagination', 'view', function (Dep) {
|
||||
to: this.collection.offset + this.collection.length,
|
||||
previous: previous,
|
||||
next: next,
|
||||
noTotal: this.collection.total === -1 || this.collection.total === -2,
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -420,7 +420,6 @@ define('views/record/list', 'view', function (Dep) {
|
||||
|
||||
data: function () {
|
||||
var paginationTop = this.pagination === 'both' ||
|
||||
this.pagination === true ||
|
||||
this.pagination === 'top';
|
||||
|
||||
var paginationBottom = this.pagination === 'both' ||
|
||||
@@ -490,7 +489,10 @@ define('views/record/list', 'view', function (Dep) {
|
||||
this.header = false;
|
||||
}
|
||||
|
||||
this.pagination = _.isUndefined(this.options.pagination) ? this.pagination : this.options.pagination;
|
||||
this.pagination = _.isUndefined(this.options.pagination) || this.options.pagination === null ?
|
||||
this.pagination :
|
||||
this.options.pagination;
|
||||
|
||||
this.checkboxes = _.isUndefined(this.options.checkboxes) ? this.checkboxes : this.options.checkboxes;
|
||||
this.selectable = _.isUndefined(this.options.selectable) ? this.selectable : this.options.selectable;
|
||||
|
||||
|
||||
@@ -787,6 +787,7 @@ define('views/record/search', 'view', function (Dep) {
|
||||
this.collection.abortLastFetch();
|
||||
this.collection.reset();
|
||||
this.collection.where = this.searchManager.getWhere();
|
||||
this.collection.offset = 0;
|
||||
|
||||
Espo.Ui.notify(this.translate('pleaseWait', 'messages'));
|
||||
|
||||
|
||||
@@ -675,10 +675,20 @@ ul.dropdown-menu > li.checkbox:last-child {
|
||||
|
||||
.list-container .pagination {
|
||||
margin: 0;
|
||||
|
||||
a.pagination-btn {
|
||||
width: 40px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
a.pagination-btn-middle {
|
||||
min-width: 130px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.list-bottom-bar {
|
||||
margin-top: 8px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.radio-container {
|
||||
|
||||
Reference in New Issue
Block a user