Bugzilla – Attachment 132579 Details for
Bug 30394
Add 'draw' handling to the datatables wrapper and REST API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30394: Make datatables.js aware of x-koha-request-id
Bug-30394-Make-datatablesjs-aware-of-x-koha-reques.patch (text/plain), 2.64 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-03-30 12:03:44 UTC
(
hide
)
Description:
Bug 30394: Make datatables.js aware of x-koha-request-id
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-03-30 12:03:44 UTC
Size:
2.64 KB
patch
obsolete
>From 4958f33f5b22d5619da1a369915367446f9661ee Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 30 Mar 2022 13:57:39 +0200 >Subject: [PATCH] Bug 30394: Make datatables.js aware of x-koha-request-id > >This patch makes the wrapper handle the data.draw parameter (from >DataTables) translating it into the x-koha-request-id header for making >the Koha request, and then translates the received header into data.draw >for proper use in DataTables. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index 12dd6683ae..d82cc3d8f8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -538,13 +538,17 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { > }, > 'dataFilter': function(data, type) { > var json = {data: JSON.parse(data)}; >- if(total = this._xhr.getResponseHeader('x-total-count')) { >+ if (total = this._xhr.getResponseHeader('x-total-count')) { > json.recordsTotal = total; > json.recordsFiltered = total; > } >- if(total = this._xhr.getResponseHeader('x-base-total-count')) { >+ if (total = this._xhr.getResponseHeader('x-base-total-count')) { > json.recordsTotal = total; > } >+ if (draw = this._xhr.getResponseHeader('x-koha-request-id')) { >+ json.draw = draw; >+ } >+ > return JSON.stringify(json); > }, > 'data': function( data, settings ) { >@@ -623,6 +627,10 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { > > dataSet._match = options.criteria; > >+ if ( data["draw"] !== undefined ) { >+ settings.ajax.headers = { 'x-koha-request-id': data.draw } >+ } >+ > if(options.columns) { > var order = data.order; > var orderArray = new Array(); >-- >2.35.1
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 30394
:
132576
|
132577
|
132578
|
132579
|
132582
|
132583
|
132584
|
132585
|
132598
|
132599
|
132600
|
132601
|
132602