Bugzilla – Attachment 153831 Details for
Bug 34226
Format dates from DT filters before querying the REST API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34226: WIP Using 'type' at the datatable config level
Bug-34226-WIP-Using-type-at-the-datatable-config-l.patch (text/plain), 3.42 KB, created by
Martin Renvoize (ashimema)
on 2023-07-24 10:16:02 UTC
(
hide
)
Description:
Bug 34226: WIP Using 'type' at the datatable config level
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-07-24 10:16:02 UTC
Size:
3.42 KB
patch
obsolete
>From f980f54225a42a8ff814c86c1af315faa7e71638 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 24 Jul 2023 11:14:31 +0100 >Subject: [PATCH] Bug 34226: WIP Using 'type' at the datatable config level > >What about using 'type' definitions at the datatables settings level and >binding that to a flatpickr instance? >--- > .../prog/en/includes/patron-search.inc | 3 +++ > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 16 ++++++++++++++++ > 2 files changed, 19 insertions(+) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >index 3c1ce6fe2c..34502bcce7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >@@ -242,6 +242,7 @@ > </script> > > [% INCLUDE 'datatables.inc' %] >+ [% INCLUDE 'calendar.inc' %] > [% INCLUDE 'js-patron-get-age.inc' %] > [% INCLUDE 'js-patron-format.inc' %] > [% INCLUDE 'js-patron-format-address.inc' %] >@@ -430,6 +431,7 @@ > [% CASE 'dateofbirth' %] > { > "data": "date_of_birth", >+ "type": "date", > "searchable": true, > "orderable": true, > "render": function( data, type, row, meta ) { >@@ -551,6 +553,7 @@ > [% CASE 'dateexpiry' %] > { > "data": "expiry_date", >+ "type": "date", > "searchable": true, > "orderable": true, > "render": function( data, type, row, meta ) { >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index 9ee051d282..49fe7a5dd4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -564,6 +564,10 @@ function _dt_default_ajax (params){ > let built_value; > let is_date_field; > >+ if ( col.type == 'date' ) { >+ is_date_field = true; >+ } >+ > if ( col.datatype !== undefined ) { > if ( col.datatype == 'date' ) { > is_date_field = true; >@@ -893,6 +897,14 @@ function _dt_add_filters(table_node, table_dt, filters_options = {}) { > o.appendTo(select); > }); > $(this).html( select ); >+ } else if (table_dt.settings()[0].aoColumns[i].sType == 'date' ) { >+ let existing_search = table_dt.column(i).search(); >+ let input = $('<input type="text" class="flatpickr" style="width: 100%" />'); >+ if (existing_search) { >+ input.prop("value", existing_search); >+ } >+ >+ $(this).html( input ); > } else { > var title = $(this).text(); > var existing_search = table_dt.column(i).search(); >@@ -923,6 +935,10 @@ function _dt_add_filters(table_node, table_dt, filters_options = {}) { > $(this).html(''); > } > } ); >+ >+ $(".flatpickr").each(function(){ >+ apply_flatpickr(this); >+ }); > } > > >-- >2.41.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 34226
:
153180
|
153830
|
153831
|
153835
|
153862
|
153863
|
153864