From 644ed8860aea4b1297d978700c2966a93e10628a Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 29 Jan 2020 11:27:51 +0000 Subject: [PATCH] Bug 23493: (follow-up) Disable rowGroup on due date sort When sorting by due date you are much more likely to want the true date sorting without forcing a primary sort on the grouping column. This patch achieves that by removing the primary sort on checkout date and disable rowGrouping in such a case. Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize --- koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js index ff3b900ad1..07d7553847 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js @@ -260,7 +260,7 @@ $(document).ready(function() { "bVisible": false, }, { - "aDataSort": [1,2], // Sort on hidden unformatted date due column + "iDataSort": 2, // Sort on hidden unformatted date due column "mDataProp": function( oObj ) { var due = oObj.date_due_formatted; @@ -644,6 +644,16 @@ $(document).ready(function() { collision: "none" }); } + + // Disable rowGroup when sorting on due date + $("#issues-table").on( 'order.dt', function(){ + var order = issuesTable.api().order(); + if ( order[0][0] === 3 ) { + issuesTable.api().rowGroup().disable(); + } else { + issuesTable.api().rowGroup().enable(); + } + }); } // Don't load relatives' issues table unless it is clicked on -- 2.20.1