We should not use dataTable() but our own KohaTable or kohaTable. It will help to get rid of repeated rules (eg. NoSort).
Created attachment 175181 [details] [review] Bug 38255: Replace dataTable constructor with kohaTable - Staff
Created attachment 175182 [details] [review] Bug 38255: Replace dataTable constructor with kohaTable - OPAC
Created attachment 175183 [details] [review] Bug 38255: Add kohaTable - OPAC
Created attachment 175184 [details] [review] Bug 38255: Early return if the node does not exist
Created attachment 175185 [details] [review] Bug 38255: Exceptions Those tables are using a svc script, not the REST API. It is not compatible with kohaTable's default 'ajax' options.
We are removing the occurrences of instantiations of dataTable(), and replace them with our own kohaTable. To make this possible we: 1. Set the default ajax options (_dt_default_ajax from datatables.js) only if an 'ajax' option is passed already 2. Simply replace 'dataTable' with 'kohaTable', and remove the merge with dataTablesDefaults (we do it already in datatables.js) 3. Introduce kohaTable at the OPAC (a shorter version of what we have staff-side as we provide less features) 4. Deal with the svc script, see the "Exceptions" patch: we pass a flag "bKohaAjaxSVC" to tell to not inject the default ajax options even if we using server-side processing (should be remove in the future, and not be used by new patches). Test plan: Test some of the tables modified by this patchset and search for errors/regressions QA note: this patch introduces way more changes than needed, I wanted to indent correctly the kohaTable block to catch potential syntax error. Happened when I forgot to remove the extra parenthesis: - })); + });
QA: `git grep '\.dataTable(' ':(exclude)*datatables*.js'|wc -l` must return 0
I'm still going through all the changes, but I ran into this when I opened the "Clubs" tab from the patron detail page: Uncaught SyntaxError: redeclaration of let clubs_dt_params
Created attachment 175352 [details] [review] Bug 38255: Fix JS error Uncaught SyntaxError: redeclaration of let
I only found a few other problems: - Manage staged MARC records - The table of staged MARC records isn't loading. There isn't an error in the console, but the table info says "No entries to show (filtered from NaN total entries)" - OPAC -> User's account -> Charges. "Uncaught TypeError: can't access property "cell", s[(a + i)][r] is undefined" - OPAC -> User's account -> Alert subscriptions: "Uncaught TypeError: can't access property "buttons", settings is null"
Created attachment 175598 [details] [review] Bug 38255: Exception - Manage staged MARC records
Created attachment 175599 [details] [review] Bug 38255: Allow instantiation without parameters `$(node).kohaTable()` should work. Without this patch we got `Uncaught TypeError: settings is null`
(In reply to Owen Leonard from comment #10) > I only found a few other problems: Nice ones, thanks a lot! > - Manage staged MARC records - The table of staged MARC records isn't > loading. There isn't an error in the console, but the table info says "No > entries to show (filtered from NaN total entries)" Fixed in "Exception - Manage staged MARC records" > - OPAC -> User's account -> Charges. "Uncaught TypeError: can't access > property "cell", s[(a + i)][r] is undefined" I don't recreate this one! What do you have in the table? > - OPAC -> User's account -> Alert subscriptions: "Uncaught TypeError: can't > access property "buttons", settings is null" This one was hiding something bigger. Fixed in "Allow instantiation without parameters"
> > - OPAC -> User's account -> Charges. "Uncaught TypeError: can't access > > property "cell", s[(a + i)][r] is undefined" > > I don't recreate this one! What do you have in the table? I'm not exactly sure what data is required to trigger it, but this is Bug 38753.
Created attachment 175872 [details] [review] Bug 38255: Exception - Item search
Created attachment 175873 [details] [review] Bug 38255: (follow-up) Replace dataTable constructor with kohaTable - Staff
Created attachment 176062 [details] [review] Bug 38255: Replace dataTable constructor with kohaTable - Staff
Created attachment 176063 [details] [review] Bug 38255: Replace dataTable constructor with kohaTable - OPAC
Created attachment 176064 [details] [review] Bug 38255: Add kohaTable - OPAC
Created attachment 176065 [details] [review] Bug 38255: Early return if the node does not exist
Created attachment 176066 [details] [review] Bug 38255: Exceptions Those tables are using a svc script, not the REST API. It is not compatible with kohaTable's default 'ajax' options.
Created attachment 176067 [details] [review] Bug 38255: Fix JS error Uncaught SyntaxError: redeclaration of let
Created attachment 176068 [details] [review] Bug 38255: Exception - Manage staged MARC records
Created attachment 176069 [details] [review] Bug 38255: Allow instantiation without parameters `$(node).kohaTable()` should work. Without this patch we got `Uncaught TypeError: settings is null`
Created attachment 176070 [details] [review] Bug 38255: Exception - Item search
Created attachment 176071 [details] [review] Bug 38255: (follow-up) Replace dataTable constructor with kohaTable - Staff
Patches rebased.
I've tested almost all staff interface tables. Only one problem stood out to me 1 .admin/cash_registers.pl -Change Filter by Library -Uncaught TypeError: table.column is not a function I have yet to test any OPAC tables.
Going through the OPAC tables, everything seems good.
Created attachment 176146 [details] [review] Bug 38255: Fix Cash registers This patch fixes the following error: Uncaught TypeError: table.column is not a function We needed to pass table.DataTable() to filterDataTable I've decided to clean the code as it does not make sense to me: filterDataTable is called from a single place, and clearFilter is not needed (we should not interfer with the 'Clear filter' button here)
Created attachment 176348 [details] [review] Bug 38255: Replace dataTable constructor with kohaTable - Staff Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 176349 [details] [review] Bug 38255: Replace dataTable constructor with kohaTable - OPAC Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 176350 [details] [review] Bug 38255: Add kohaTable - OPAC Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 176351 [details] [review] Bug 38255: Early return if the node does not exist Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 176352 [details] [review] Bug 38255: Exceptions Those tables are using a svc script, not the REST API. It is not compatible with kohaTable's default 'ajax' options. Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 176353 [details] [review] Bug 38255: Fix JS error Uncaught SyntaxError: redeclaration of let Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 176354 [details] [review] Bug 38255: Exception - Manage staged MARC records Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 176355 [details] [review] Bug 38255: Allow instantiation without parameters `$(node).kohaTable()` should work. Without this patch we got `Uncaught TypeError: settings is null` Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 176356 [details] [review] Bug 38255: Exception - Item search Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 176357 [details] [review] Bug 38255: (follow-up) Replace dataTable constructor with kohaTable - Staff Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 176358 [details] [review] Bug 38255: Fix Cash registers This patch fixes the following error: Uncaught TypeError: table.column is not a function We needed to pass table.DataTable() to filterDataTable I've decided to clean the code as it does not make sense to me: filterDataTable is called from a single place, and clearFilter is not needed (we should not interfer with the 'Clear filter' button here) Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 176550 [details] [review] Bug 38255: Replace dataTable constructor with kohaTable - Staff Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 176551 [details] [review] Bug 38255: Replace dataTable constructor with kohaTable - OPAC Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 176552 [details] [review] Bug 38255: Add kohaTable - OPAC Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 176553 [details] [review] Bug 38255: Early return if the node does not exist Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 176554 [details] [review] Bug 38255: Exceptions Those tables are using a svc script, not the REST API. It is not compatible with kohaTable's default 'ajax' options. Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 176555 [details] [review] Bug 38255: Fix JS error Uncaught SyntaxError: redeclaration of let Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 176556 [details] [review] Bug 38255: Exception - Manage staged MARC records Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 176557 [details] [review] Bug 38255: Allow instantiation without parameters `$(node).kohaTable()` should work. Without this patch we got `Uncaught TypeError: settings is null` Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 176558 [details] [review] Bug 38255: Exception - Item search Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 176559 [details] [review] Bug 38255: (follow-up) Replace dataTable constructor with kohaTable - Staff Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 176560 [details] [review] Bug 38255: Fix Cash registers This patch fixes the following error: Uncaught TypeError: table.column is not a function We needed to pass table.DataTable() to filterDataTable I've decided to clean the code as it does not make sense to me: filterDataTable is called from a single place, and clearFilter is not needed (we should not interfer with the 'Clear filter' button here) Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 177076 [details] [review] Bug 38255: Replace dataTable constructor with kohaTable - Staff Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 177077 [details] [review] Bug 38255: Replace dataTable constructor with kohaTable - OPAC Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 177078 [details] [review] Bug 38255: Add kohaTable - OPAC Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 177079 [details] [review] Bug 38255: Early return if the node does not exist Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 177080 [details] [review] Bug 38255: Exceptions Those tables are using a svc script, not the REST API. It is not compatible with kohaTable's default 'ajax' options. Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 177081 [details] [review] Bug 38255: Fix JS error Uncaught SyntaxError: redeclaration of let Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 177082 [details] [review] Bug 38255: Exception - Manage staged MARC records Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 177083 [details] [review] Bug 38255: Allow instantiation without parameters `$(node).kohaTable()` should work. Without this patch we got `Uncaught TypeError: settings is null` Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 177084 [details] [review] Bug 38255: Exception - Item search Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 177085 [details] [review] Bug 38255: (follow-up) Replace dataTable constructor with kohaTable - Staff Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 177086 [details] [review] Bug 38255: Fix Cash registers This patch fixes the following error: Uncaught TypeError: table.column is not a function We needed to pass table.DataTable() to filterDataTable I've decided to clean the code as it does not make sense to me: filterDataTable is called from a single place, and clearFilter is not needed (we should not interfer with the 'Clear filter' button here) Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
just a rebase.
Created attachment 177214 [details] [review] Bug 38255: Replace dataTable constructor with kohaTable - Staff Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 177215 [details] [review] Bug 38255: Replace dataTable constructor with kohaTable - OPAC Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 177216 [details] [review] Bug 38255: Add kohaTable - OPAC Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 177217 [details] [review] Bug 38255: Early return if the node does not exist Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 177218 [details] [review] Bug 38255: Exceptions Those tables are using a svc script, not the REST API. It is not compatible with kohaTable's default 'ajax' options. Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 177219 [details] [review] Bug 38255: Fix JS error Uncaught SyntaxError: redeclaration of let Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 177220 [details] [review] Bug 38255: Exception - Manage staged MARC records Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 177221 [details] [review] Bug 38255: Allow instantiation without parameters `$(node).kohaTable()` should work. Without this patch we got `Uncaught TypeError: settings is null` Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 177222 [details] [review] Bug 38255: Exception - Item search Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 177223 [details] [review] Bug 38255: (follow-up) Replace dataTable constructor with kohaTable - Staff Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 177224 [details] [review] Bug 38255: Fix Cash registers This patch fixes the following error: Uncaught TypeError: table.column is not a function We needed to pass table.DataTable() to filterDataTable I've decided to clean the code as it does not make sense to me: filterDataTable is called from a single place, and clearFilter is not needed (we should not interfer with the 'Clear filter' button here) Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Yet another rebase.
Created attachment 177262 [details] [review] Bug 38255: Fix additional-contents