Bugzilla – Attachment 173467 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: Fix Vue tables
Bug-33484-Fix-Vue-tables.patch (text/plain), 4.84 KB, created by
Jonathan Druart
on 2024-10-28 09:45:46 UTC
(
hide
)
Description:
Bug 33484: Fix Vue tables
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2024-10-28 09:45:46 UTC
Size:
4.84 KB
patch
obsolete
>From 3c4cafa205afdf9eca8e4b8cdb9395a584770df6 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 8 Oct 2024 14:58:16 +0200 >Subject: [PATCH] Bug 33484: Fix Vue tables > >datatables.net-vue3 does not use a specific id, and does not let us pass >one. It is generated, like: DataTables_Table_0 (and increment when a new >table is created). >So it's not possible to use this id: it can change and so is not >reliable. > >I have tried to pass "data-koha-table-id" with a specific id >(KohaTable_agreements). Which was working, but actually we could simply >use the table settings key to identify the tables in the URL. > >Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../prog/en/includes/columns_settings.inc | 10 +++++++--- > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 10 +++++++--- > 2 files changed, 14 insertions(+), 6 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc >index 0ed07f38671..8ede3d3168e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc >@@ -39,7 +39,7 @@ function KohaTable(id_selector, dt_parameters, table_settings, add_filters) { > > // Load state from URL > const url = new URL(window.location.href); >- let state_from_url = url.searchParams.get( settings.nTable.id + '_state'); >+ let state_from_url = url.searchParams.get( table_key + '_state'); > if ( state_from_url ) { > settings.loaded_from_state = true; > return JSON.parse(atob(state_from_url)); >@@ -221,11 +221,15 @@ function KohaTable(id_selector, dt_parameters, table_settings, add_filters) { > titleAttr: __("Copy conditions"), > text: '<i class="fa fa-lg fa-copy"></i> <span class="dt-button-text">' + __("Copy conditions") + '</span>', > action: function (e, dt, node, config) { >+ let table_key = 'DataTables_%s_%s_%s'.format( >+ table_settings.module, >+ table_settings.page, >+ table_settings.table); >+ > let state = JSON.stringify(dt.state()); > delete state.time; > let searchParams = new URLSearchParams(window.location.search); >- let table_id = dt.table().node().id; >- searchParams.set(table_id + '_state', btoa(state)); >+ searchParams.set(table_key + '_state', btoa(state)); > let url = window.location.origin + window.location.pathname + '?' + searchParams.toString() + window.location.hash; > if( navigator.clipboard && navigator.clipboard.writeText){ > navigator.clipboard.writeText( url ); >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index 73a0d1eea4f..f42eeb6c8a5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -767,11 +767,15 @@ function _dt_buttons(params){ > titleAttr: __("Copy conditions"), > text: '<i class="fa fa-lg fa-copy"></i> <span class="dt-button-text">' + __("Copy conditions") + '</span>', > action: function (e, dt, node, config) { >+ let table_key = 'DataTables_%s_%s_%s'.format( >+ table_settings.module, >+ table_settings.page, >+ table_settings.table); >+ > let state = JSON.stringify(dt.state()); > delete state.time; > let searchParams = new URLSearchParams(window.location.search); >- let table_id = dt.table().node().id; >- searchParams.set(table_id + '_state', btoa(state)); >+ searchParams.set(table_key + '_state', btoa(state)); > let url = window.location.origin + window.location.pathname + '?' + searchParams.toString() + window.location.hash; > if( navigator.clipboard && navigator.clipboard.writeText){ > navigator.clipboard.writeText( url ); >@@ -983,7 +987,7 @@ function _dt_save_restore_state(table_settings){ > > // Load state from URL > const url = new URL(window.location.href); >- let state_from_url = url.searchParams.get( settings.nTable.id + '_state'); >+ let state_from_url = url.searchParams.get( table_key + '_state'); > if ( state_from_url ) { > settings.loaded_from_state = true; > return JSON.parse(atob(state_from_url)); >-- >2.34.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 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