Bugzilla – Attachment 149928 Details for
Bug 33484
Ability to remember user's selected table configuration and search filters for tables
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33484: Add support to kohaTable (AJAX Tables)
Bug-33484-Add-support-to-kohaTable-AJAX-Tables.patch (text/plain), 2.57 KB, created by
Martin Renvoize (ashimema)
on 2023-04-20 10:25:36 UTC
(
hide
)
Description:
Bug 33484: Add support to kohaTable (AJAX Tables)
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-04-20 10:25:36 UTC
Size:
2.57 KB
patch
obsolete
>From be852ada03d0a1b65d8969d737a118249d19bfae Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 19 Apr 2023 16:49:06 +0100 >Subject: [PATCH] Bug 33484: Add support to kohaTable (AJAX Tables) > >--- > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 36 +++++++++++++++++++ > 1 file changed, 36 insertions(+) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index bcf308c56c..de93c14d37 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -883,6 +883,24 @@ function _dt_add_filters(table_node, table_dt, filters_options = {}) { > } ); > } > >+function _dt_get_saved_state( localstorage_config, columns_settings ){ >+ var tables = JSON.parse( localstorage_config ); >+ // if a table configuration was found in local storage, parse it >+ if( tables ){ >+ var stateSave_column_visibility = []; >+ $(tables.columns).each(function(){ >+ stateSave_column_visibility.push( this.visible === true ? 0 : 1 ); >+ }); >+ $.each( columns_settings, function( index, key ){ >+ if( stateSave_column_visibility[ index ] !== columns_settings[key] ){ >+ columns_settings[ index ].is_hidden = stateSave_column_visibility[ index ]; >+ } >+ }); >+ return columns_settings; >+ } else { >+ return columns_settings; >+ } >+} > > (function($) { > >@@ -937,6 +955,24 @@ function _dt_add_filters(table_node, table_dt, filters_options = {}) { > } > > if ( table_settings ) { >+ >+ var table_key = >+ 'DataTables_' + >+ table_settings['module'] +'_' + >+ table_settings['page'] +'_' + >+ table_settings['table']; >+ >+ settings["stateSave"] = true; >+ settings["stateSaveCallback"] = function( settings, data ) { >+ localStorage.setItem( table_key, JSON.stringify(data) ) >+ } >+ settings["stateLoadCallback"] = function(settings) { >+ return JSON.parse( localStorage.getItem(table_key) ) >+ } >+ var local_settings = localStorage.getItem(table_key); >+ var system_settings = table_settings["columns"]; >+ var columns_settings = _dt_get_saved_state(local_settings, system_settings); >+ > if ( table_settings.hasOwnProperty('default_display_length') && table_settings['default_display_length'] != null ) { > settings["pageLength"] = table_settings['default_display_length']; > } >-- >2.40.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 33484
:
149444
|
149445
|
149447
|
149448
|
149449
|
149925
|
149926
|
149927
|
149928
|
149929
|
149930
|
149974
|
149975
|
149976
|
149977
|
149978
|
149979
|
173443
|
173444
|
173445
|
173446
|
173447
|
173448
|
173449
|
173450
|
173451
|
173452
|
173453
|
173454
|
173455
|
173456
|
173457
|
173458
|
173459
|
173460
|
173461
|
173462
|
173463
|
173464
|
173465
|
173466
|
173467
|
173468
|
173469
|
173470
|
173471
|
173472
|
173473
|
173474
|
173475
|
173476
|
173477
|
173478
|
173479
|
173480
|
173481
|
173482
|
173483
|
173484
|
173485
|
173486
|
173546
|
173606
|
173607
|
173985
|
174219