mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°3914 - Polishing: Lists - remove pagination when it is unnecessary
This commit is contained in:
@@ -167,8 +167,9 @@ var oTable{{ sListIDForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({
|
||||
method: "post",
|
||||
pages: 1 // number of pages to cache
|
||||
}),
|
||||
createdRow: function( row, data, dataIndex ) {
|
||||
if (data['@class'] !== undefined) {
|
||||
createdRow: function (row, data, dataIndex) {
|
||||
if (data['@class'] !== undefined)
|
||||
{
|
||||
$(row).addClass(data['@class']);
|
||||
}
|
||||
},
|
||||
@@ -176,8 +177,7 @@ var oTable{{ sListIDForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({
|
||||
this.api().columns.adjust().draw();
|
||||
if (this.api().page.info().pages < 2)
|
||||
{
|
||||
this.parent().find('.dataTables_paginate').hide();
|
||||
this.parent().find('.dataTables_length').hide();
|
||||
this.closest('.dataTables_wrapper').find('.dataTables_length').hide();
|
||||
}
|
||||
this.find('.ibo-dataTables--processing').remove();
|
||||
this.find('tbody').unblock();
|
||||
|
||||
@@ -41,6 +41,13 @@ var oTable{{ sListIDForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({
|
||||
$(row).addClass(data['@class']);
|
||||
}
|
||||
},
|
||||
|
||||
initComplete: function () {
|
||||
if (this.api().page.info().pages < 2)
|
||||
{
|
||||
this.closest('.dataTables_wrapper').find('.dataTables_length').hide();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
{% if (oUIBlock.GetOption('bFullscreen')) %}
|
||||
|
||||
@@ -58,15 +58,25 @@ var oTable{{ sListIDForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({
|
||||
],
|
||||
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) {
|
||||
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 {
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).closest('.dataTables_wrapper').find('.dataTables_paginate, .dataTables_info').show();
|
||||
}
|
||||
},
|
||||
initComplete: function () {
|
||||
if (this.api().page.info().pages < 2)
|
||||
{
|
||||
this.closest('.dataTables_wrapper').find('.dataTables_length').hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if(window.ResizeObserver){
|
||||
if (window.ResizeObserver)
|
||||
{
|
||||
let oStaticTable{{ sListIDForVarSuffix }}ResizeTimeout = null;
|
||||
const oStaticTable{{ sListIDForVarSuffix }}Resize = new ResizeObserver(function(){
|
||||
clearTimeout(oStaticTable{{ sListIDForVarSuffix }}ResizeTimeout);
|
||||
|
||||
Reference in New Issue
Block a user