Bug 32477: Launch function hideColumns after changing datatables settings

Hiding columns in batch item modification breaks if page is
loaded again. If one hides e.g. column "Collection" and then loads
the page column "Holds" disappears. Also behaviour of checbox
changes for "Collection" column. This happens because we launch
function "hideColumns" before changing datatables settings and
"hidden" column with class "sorting_1" is still present.

To test:
1. Find items to modify and modify them with batch item
modification tool.
2. In modification page, hide column "Collection". Confirm
correct column is hidden.
3. Reload the page or modify items again.
=> Note that column "Holds" is now hidden and checking checkbox
for column "Collection" behaves incorrectly (unchecked checkbox
shows column, checked hides it)
4. Apply this patch.
5. Repeat steps 1, 2 and 3.
=> Confirm correct column is now hidden when page is loaded again
and checkbox works correctly.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 71a7aa1cdc)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Emmi Takkinen 2023-11-23 13:15:57 +02:00 committed by Fridolin Somers
parent fa443bcef1
commit ff32095205

View file

@ -117,7 +117,6 @@ function hideAllColumns() {
}
$(document).ready(function () {
hideColumns();
var items_table = KohaTable("itemst", {
"aoColumnDefs": [
{ "aTargets": [0, 1], "bSortable": false, "bSearchable": true },
@ -126,6 +125,9 @@ $(document).ready(function () {
],
"bPaginate": false,
});
hideColumns();
// Highlight in yellow item rows that cannot be deleted
$(".error").parents('tr').find('td').css('background-color', '#ffff99');