Bug 11756: improve default sorting on hold ratios report
authorOwen Leonard <oleonard@myacpl.org>
Fri, 14 Feb 2014 13:48:46 +0000 (08:48 -0500)
committerGalen Charlton <gmc@esilibrary.com>
Tue, 18 Feb 2014 23:45:35 +0000 (23:45 +0000)
The DataTables plugin doesn't by default take multiple columns into
account when sorting. The hold ratios report presents a situation where
it makes sense to sort by default based on two columns: hold count and
title, since there are likely to be many titles with the same hold
count.

This patch adds sorting by default on holds (descending) and title
(ascending). It also modifies the configuration of the title sort to
exclude articles when sorting.

To test, view the hold ratios report. If necessary use the filter form
to reduce the minimum hold ratio and generate more results. Confirm that
the correct columns can be sorted.

Note that by default one can manually trigger sorting on two columns by
shift-clicking the second column header.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt

index d55382e..2cc539a 100644 (file)
             function () { $(this).toggleClass("ulined") }
         );
         $("#holdst").dataTable($.extend(true, {}, dataTablesDefaults, {
+            "aaSorting": [ [0,'desc'], [3,'asc'] ],
             "aoColumnDefs": [
                 { "aTargets": [ 8 ], "sType": "natural" }
             ],
+            "aoColumns": [
+                null,
+                null,
+                null,
+                { "sType": "anti-the" },
+                null,
+                null,
+                null,
+                null,
+                null
+            ],
             "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
             "iDisplayLength": 20,
             "sPaginationType": "four_button"