From 790150b31277e6ded86823add0385c5960a4876e Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Wed, 2 Aug 2017 10:35:49 +0200 Subject: [PATCH] Bug 19021: Fix Inventory columns sorting In inventory result page, items are shown in a JS DataTable. For an inventory with barcode file second column is not sortable for no reason. For an inventory without barcode file first column is not sortable but since it is the default sort order the sorting icon is still displayed. This patch corrects by setting default sort order on callnumber column. Test plan : - perform inventory with barcode file - look at result table - table is sorted by callnumber => Without patch second column is not sortable => With patch all columns are sortable - perform inventory without barcode file - look at result table => Without patch first column show sort icon and table is not sorted by callnumber => With patch first column is not sortable and table is sorted by callnumber Signed-off-by: Katrin Fischer Signed-off-by: Kyle M Hall Signed-off-by: Jonathan Druart --- .../intranet-tmpl/prog/en/modules/tools/inventory.tt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt index 13359ad7af..00b818384e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt @@ -33,9 +33,15 @@ $(document).ready(function(){ inventorydt = $('#inventoryt').dataTable($.extend(true, {}, dataTablesDefaults, { 'sPaginationType': 'full_numbers', [% IF compareinv2barcd %] - "aoColumnDefs": [ { "bSortable": false, "aTargets": [ 1 ] } ], + // sort on callnumber + "aaSorting": [[ 1, "asc" ]], [% ELSE %] - "aoColumnDefs": [ { "bSortable": false, "aTargets": [ 0 ] } ], + // first column contains checkboxes + "aoColumnDefs": [ + { "bSortable": false, "bSearchable": false, "aTargets": [ 0 ] }, + ], + // 3rd column is callnumber + "aaSorting": [[ 2, "asc" ]], [% END %] 'fnDrawCallback': function() { //bind the click handler script to the newly created elements held in the table -- 2.39.5