mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°3914 Hide lists pagination when there's only 1 page
This commit is contained in:
@@ -75,17 +75,30 @@ var oTable{{ sListIfForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({
|
||||
if ($(this).closest('.ibo-panel--body').find('[name=selectionMode]').val() === "negative") {
|
||||
$(this).closest('.dataTables_wrapper').find('.checkAll')[0].checked = true;
|
||||
}
|
||||
else {
|
||||
$(this).closest('.dataTables_wrapper').find('.dataTables_paginate, .dataTables_info').show();
|
||||
}
|
||||
bSelectAllowed{{ oUIBlock.GetId() }} = true;
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
||||
$("#{{ oUIBlock.GetId() }} a").on('click', function (e) {
|
||||
//disable select action when there is a link
|
||||
e.stopPropagation();
|
||||
});
|
||||
},
|
||||
{% endif %}
|
||||
{% else %}
|
||||
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();
|
||||
}
|
||||
},
|
||||
{% endif %}
|
||||
rowId: "id",
|
||||
filter: false,
|
||||
retrieve: true,
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -41,9 +41,6 @@ $('#{{ oUIBlock.GetId() }}').DataTable({
|
||||
{% if oUIBlock.GetOption("pageLength") is not empty %}
|
||||
pageLength: {{ oUIBlock.GetOption("pageLength") }},
|
||||
{% endif %}
|
||||
{% if oUIBlock.GetData()|length <= iPageSize %}
|
||||
paging: false,
|
||||
{% endif %}
|
||||
{% if oUIBlock.GetOption("dom") is not empty %}
|
||||
dom: "<'ibo-datatable-toolbar'{{ oUIBlock.GetOption("dom") }}>t",
|
||||
{% else %}
|
||||
@@ -58,7 +55,15 @@ $('#{{ oUIBlock.GetId() }}').DataTable({
|
||||
sortable: true
|
||||
},
|
||||
{% endfor %}
|
||||
]
|
||||
],
|
||||
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(window.ResizeObserver){
|
||||
|
||||
Reference in New Issue
Block a user