Bugzilla – Attachment 118825 Details for
Bug 27807
API DataTables Wrapper fails for ordered on multiple columns
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27807: Add multi-column ordering support to datatables wrapper
Bug-27807-Add-multi-column-ordering-support-to-dat.patch (text/plain), 2.46 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-03-25 16:18:24 UTC
(
hide
)
Description:
Bug 27807: Add multi-column ordering support to datatables wrapper
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-03-25 16:18:24 UTC
Size:
2.46 KB
patch
obsolete
>From 3c07ca0ac35f51af28103953fa2ba3e4fc37096a Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 2 Mar 2021 10:36:06 +0000 >Subject: [PATCH] Bug 27807: Add multi-column ordering support to datatables > wrapper > >This patch add mutli-column ordering support to the datatables api >wrapper. > >Test plan >1/ Add a series of cities to the system with various combinations of >city and state such that you can distinguish sorting on city + state in >city ascending + state ascending, city ascending + state descending etc. >2/ Attempt to sort on the two fields in the table (Click the 'City' >heading to sort on city name, then Shift Click on 'State' to add 'state' >ordering on top.. Shift click again on state to reverse the 'state' >ordering but maintain the 'City' ordering. >3/ Confirm the various ordering comes out correctly. >4/ Signoff > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index 1b1a7191412..25373b9306b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -634,13 +634,15 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { > > if(options.columns) { > var order = data.order; >+ var orderArray = new Array(); > order.forEach(function (e,i) { > var order_col = e.column; > var order_by = options.columns[order_col].data; > order_by = order_by.split(':'); > var order_dir = e.dir == 'asc' ? '+' : '-'; >- dataSet._order_by = order_by.map(x => order_dir + (!x.includes('.')?'me.'+x:x)).join(','); >+ orderArray.push(order_by.map(x => order_dir + (!x.includes('.')?'me.'+x:x)).join(',')); > }); >+ dataSet._order_by = orderArray.join(','); > } > > return dataSet; >-- >2.31.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27807
:
117502
|
117504
|
117506
|
117514
|
117515
| 118825 |
118826