N°3914 Hide lists pagination when there's only 1 page

This commit is contained in:
Stephen Abello
2021-05-27 11:20:48 +02:00
parent 0cb0f52b12
commit 6d57945bd1
3 changed files with 34 additions and 8 deletions

View File

@@ -24,6 +24,14 @@ var table{{ sListIDForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({
{orderable: false, targets: 0}
],
{% endif %}
drawCallback: function () {
// Hiding pagination if only one page
if ($(this).closest('.dataTables_wrapper').find('.dataTables_paginate:last .paginate_button:not(.previous):not(.next)').length < 2) {
$(this).closest('.dataTables_wrapper').find('.dataTables_paginate, .dataTables_info').hide();
} else {
$(this).closest('.dataTables_wrapper').find('.dataTables_paginate, .dataTables_info').show();
}
}
});
if ($('#{{ oUIBlock.GetId() }}').find('thead').is(':visible')) {
table{{ sListIDForVarSuffix }}.columns.adjust().draw();