Bugzilla – Attachment 178462 Details for
Bug 38255
Do not use dataTable constructor directly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38255: Allow instantiation without parameters
Bug-38255-Allow-instantiation-without-parameters.patch (text/plain), 4.54 KB, created by
Martin Renvoize (ashimema)
on 2025-02-21 09:33:16 UTC
(
hide
)
Description:
Bug 38255: Allow instantiation without parameters
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-02-21 09:33:16 UTC
Size:
4.54 KB
patch
obsolete
>From fa491bcbc781729aba65dcf749d02fde9559696a Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 17 Dec 2024 10:48:28 +0100 >Subject: [PATCH] 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> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 34 +++++++++---------- > .../opac-tmpl/bootstrap/js/datatables.js | 34 +++++++++---------- > 2 files changed, 32 insertions(+), 36 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index 0becbb4ef12..f094bae8d3d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -1300,7 +1300,7 @@ function update_search_description( > * @return {Object} The dataTables instance > */ > $.fn.kohaTable = function ( >- options, >+ options = {}, > table_settings, > add_filters, > default_filters, >@@ -1309,8 +1309,6 @@ function update_search_description( > show_search_descriptions, > additional_search_descriptions > ) { >- var settings = null; >- > // Early return if the node does not exist > if (!this.length) return; > >@@ -1334,23 +1332,23 @@ function update_search_description( > options.processing = true; > options.pagingType = "full_numbers"; > } >+ } > >- settings = $.extend( >- true, >- {}, >- dataTablesDefaults, >- { >- paging: true, >- searching: true, >- language: { >- emptyTable: options.emptyTable >- ? options.emptyTable >- : __("No data available in table"), >- }, >+ var settings = $.extend( >+ true, >+ {}, >+ dataTablesDefaults, >+ { >+ paging: true, >+ searching: true, >+ language: { >+ emptyTable: options.emptyTable >+ ? options.emptyTable >+ : __("No data available in table"), > }, >- options >- ); >- } >+ }, >+ options >+ ); > > settings["buttons"] = _dt_buttons({ settings, table_settings }); > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js b/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js >index d16b428263b..5abae7494d6 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js >@@ -295,9 +295,7 @@ function _dt_visibility(table_settings, table_dt) { > * available from the columns_settings template toolkit include > * @return {Object} The dataTables instance > */ >- $.fn.kohaTable = function (options, table_settings) { >- var settings = null; >- >+ $.fn.kohaTable = function (options = {}, table_settings = undefined) { > // Early return if the node does not exist > if (!this.length) return; > >@@ -310,23 +308,23 @@ function _dt_visibility(table_settings, table_dt) { > dataTablesDefaults.initComplete(settings, json); > }; > } >+ } > >- settings = $.extend( >- true, >- {}, >- dataTablesDefaults, >- { >- paging: true, >- searching: true, >- language: { >- emptyTable: options.emptyTable >- ? options.emptyTable >- : __("No data available in table"), >- }, >+ var settings = $.extend( >+ true, >+ {}, >+ dataTablesDefaults, >+ { >+ paging: true, >+ searching: true, >+ language: { >+ emptyTable: options.emptyTable >+ ? options.emptyTable >+ : __("No data available in table"), > }, >- options >- ); >- } >+ }, >+ options >+ ); > > settings["buttons"] = _dt_buttons({ settings, table_settings }); > >-- >2.48.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 38255
:
175181
|
175182
|
175183
|
175184
|
175185
|
175352
|
175598
|
175599
|
175872
|
175873
|
176062
|
176063
|
176064
|
176065
|
176066
|
176067
|
176068
|
176069
|
176070
|
176071
|
176146
|
176348
|
176349
|
176350
|
176351
|
176352
|
176353
|
176354
|
176355
|
176356
|
176357
|
176358
|
176550
|
176551
|
176552
|
176553
|
176554
|
176555
|
176556
|
176557
|
176558
|
176559
|
176560
|
177076
|
177077
|
177078
|
177079
|
177080
|
177081
|
177082
|
177083
|
177084
|
177085
|
177086
|
177214
|
177215
|
177216
|
177217
|
177218
|
177219
|
177220
|
177221
|
177222
|
177223
|
177224
|
177262
|
177875
|
177876
|
177877
|
177878
|
177879
|
177880
|
177881
|
177882
|
177883
|
177884
|
177885
|
177886
|
178455
|
178456
|
178457
|
178458
|
178459
|
178460
|
178461
| 178462 |
178463
|
178464
|
178465
|
178466