Bug 24533: Switch to aDataSort for multi-column sorting

This patch adds aDataSort configurations for each sortable column such
that we always maintain the group sorting primarily and apply a
secondary sort using the column in question.

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. We achieve
that by removing the primary sort on checkout date and disable rowGrouping
in such a case.

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Works as advertised. When sorting on "Due date", the grouping by
"Previous/Today's checkouts" is disabled.
Signed-off-by: Jan Kissig <bibliothek@th-wildau.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 7a3fee3348)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Martin Renvoize 2025-03-05 09:08:00 +00:00 committed by Paul Derscheid
parent 433e964526
commit bb6aba3b1e
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
1 changed files with 23 additions and 1 deletions

View File

@ -245,16 +245,19 @@ function LoadIssuesTable() {
return title;
},
type: "anti-the",
orderData: [1, 3],
},
{
data: function (oObj) {
return oObj.recordtype_description.escapeHtml();
},
orderData: [1, 4],
},
{
data: function (oObj) {
return oObj.itemtype_description.escapeHtml();
},
orderData: [1, 5],
},
{
data: function (oObj) {
@ -262,11 +265,13 @@ function LoadIssuesTable() {
? oObj.collection.escapeHtml()
: "";
},
orderData: [1, 6],
},
{
data: function (oObj) {
return oObj.location ? oObj.location.escapeHtml() : "";
},
orderData: [1, 7],
},
{
data: function (oObj) {
@ -274,13 +279,14 @@ function LoadIssuesTable() {
? oObj.homebranch.escapeHtml()
: "";
},
orderData: [1, 8],
},
{
data: "issuedate",
visible: false,
},
{
orderData: 10, // Sort on hidden unformatted issuedate column
orderData: [1, 10], // Sort on hidden unformatted issuedate column
data: function (oObj) {
return $datetime(oObj.issuedate, {
no_tz_adjust: true,
@ -293,6 +299,7 @@ function LoadIssuesTable() {
? oObj.branchname.escapeHtml()
: "";
},
orderData: [1, 11],
},
{
data: function (oObj) {
@ -300,6 +307,7 @@ function LoadIssuesTable() {
? oObj.itemcallnumber.escapeHtml()
: "";
},
orderData: [1, 12],
},
{
data: function (oObj) {
@ -307,6 +315,7 @@ function LoadIssuesTable() {
? oObj.copynumber.escapeHtml()
: "";
},
orderData: [1, 13],
},
{
data: function (oObj) {
@ -317,6 +326,7 @@ function LoadIssuesTable() {
"<span>"
);
},
orderData: [1, 14],
className: "nowrap",
},
{
@ -328,6 +338,7 @@ function LoadIssuesTable() {
"<span>"
);
},
orderData: [1, 15],
className: "nowrap",
},
{
@ -339,6 +350,7 @@ function LoadIssuesTable() {
"<span>"
);
},
orderData: [1, 16],
className: "nowrap",
},
{
@ -702,6 +714,16 @@ function LoadIssuesTable() {
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();
}
});
}
var loadIssuesTableDelayTimeoutId;