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