Bugzilla – Attachment 168483 Details for
Bug 37238
Add table settings to itemsearch results
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37238: Replace jquery.dataTables.columnFilter.js with native DataTables function
Bug-37238-Replace-jquerydataTablescolumnFilterjs-w.patch (text/plain), 5.48 KB, created by
Lucas Gass (lukeg)
on 2024-07-03 22:24:50 UTC
(
hide
)
Description:
Bug 37238: Replace jquery.dataTables.columnFilter.js with native DataTables function
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2024-07-03 22:24:50 UTC
Size:
5.48 KB
patch
obsolete
>From b5323845f7c8721d25930444925903ae82196882 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Wed, 3 Jul 2024 22:24:03 +0000 >Subject: [PATCH] Bug 37238: Replace jquery.dataTables.columnFilter.js with > native DataTables function > >--- > .../prog/en/modules/catalogue/itemsearch.tt | 86 +++++-------------- > 1 file changed, 21 insertions(+), 65 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt >index 0693811def..a2d0f526e6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt >@@ -288,7 +288,6 @@ > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'datatables.inc' %] > [% INCLUDE 'columns_settings.inc' %] >- [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %] > [% Asset.js("lib/hc-sticky/hc-sticky.js") | $raw %] > [% INCLUDE 'select2.inc' %] > <script> >@@ -435,7 +434,8 @@ > + ' </div>' > + ' </div>' > + ' <table id="results">' >- + ' <thead>' + tr + tr + '</thead>' >+ + ' <thead>' + tr + '</thead>' >+ + ' <tfoot>' + tr + '</tfoot>' > + ' <tbody></tbody>' > + ' </table>' > + '</div>'; >@@ -526,70 +526,26 @@ > "drawCallback": function( settings ) { > prepSelections(); > }, >+ "initComplete": function() { >+ $('#results').DataTable().columns().every(function () { >+ let column = this; >+ let columnName = $(column.footer()).data('colname'); >+ let title = column.footer().textContent; >+ >+ let input = document.createElement('input'); >+ input.classList.add('text_filter', 'form-control' , 'search_init'); >+ input.placeholder = title; >+ column.footer().replaceChildren(input); >+ >+ input.addEventListener('keyup', () => { >+ if (column.search() !== this.value) { >+ column.search(input.value).draw(); >+ } >+ }); >+ }); >+ }, > fixedHeader: false // There is a bug on this view >- }, table_settings ).columnFilter({ >- 'sPlaceHolder': 'head:after', >- "columns": [ >- null, >- { 'type': 'text' }, >- { 'type': 'text' }, >- { 'type': 'text' }, >- [% IF ccodes.size %] >- { 'type': 'select', 'values': [% INCLUDE escape_html_value_label elts => ccodes %] }, >- [% ELSE %] >- null, >- [% END %] >- { 'type': 'text' }, >- { 'type': 'text' }, >- { 'type': 'text' }, >- { 'type': 'text' }, >- { 'type': 'select', 'values': [% INCLUDE escape_html_value_label elts => branches %] }, >- { 'type': 'select', 'values': [% INCLUDE escape_html_value_label elts => branches %] }, >- [% IF locations.size %] >- { 'type': 'select', 'values': [% INCLUDE escape_html_value_label elts => locations %] }, >- [% ELSE %] >- null, >- [% END %] >- [% IF itemtypes.size %] >- { 'type': 'select', 'values': [% INCLUDE escape_html_value_label elts => itemtypes %] }, >- [% ELSE %] >- null, >- [% END %] >- { 'type': 'text' }, >- [% IF notforloans.size %] >- { 'type': 'select', 'values': [% INCLUDE escape_html_value_label elts => notforloans %] }, >- [% ELSE %] >- null, >- [% END %] >- [% IF itemlosts.size %] >- { 'type': 'select', 'values': [% INCLUDE escape_html_value_label elts => itemlosts %] }, >- [% ELSE %] >- null, >- [% END %] >- [% IF withdrawns.size %] >- { 'type': 'select', 'values': [% INCLUDE escape_html_value_label elts => withdrawns %] }, >- [% ELSE %] >- null, >- [% END %] >- [% IF damageds.size %] >- { 'type': 'select', 'values': [% INCLUDE escape_html_value_label elts => damageds %] }, >- [% ELSE %] >- null, >- [% END %] >- { 'type': 'text' }, >- { 'type': 'text' }, >- { 'type': 'text' }, >- null >- ] >- }); >- $('#results').on('draw.dt', function (e, settings) { >- prepSelections(); >- var Sticky = $("#searchheader"); >- Sticky.hcSticky({ >- stickTo: "#results-wrapper .page-section", >- stickyClass: "floating" >- }); >- }); >+ }, table_settings ); > } > > $(document).ready(function () { >-- >2.39.2
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 37238
:
168409
|
168411
|
168483
|
170785
|
171037
|
173414
|
173415
|
173416
|
173740
|
173765
|
173766
|
173768
|
173785
|
173786
|
173787