Bugzilla – Attachment 176355 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.28 KB, created by
Lucas Gass (lukeg)
on 2025-01-10 14:53:26 UTC
(
hide
)
Description:
Bug 38255: Allow instantiation without parameters
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2025-01-10 14:53:26 UTC
Size:
4.28 KB
patch
obsolete
>From baa4e30d657b9d91d93cdefeb120ab959f06366c 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> >--- > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 20 +++++++++---------- > .../opac-tmpl/bootstrap/js/datatables.js | 20 +++++++++---------- > 2 files changed, 18 insertions(+), 22 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index 51ad76afe21..b2b82727cb1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -1011,8 +1011,7 @@ function _dt_save_restore_state(table_settings, external_filter_nodes={}){ > * @param {Object} default_filters Add a set of default search filters to apply at table initialisation > * @return {Object} The dataTables instance > */ >- $.fn.kohaTable = function(options, table_settings, add_filters, default_filters, filters_options, external_filter_nodes) { >- var settings = null; >+ $.fn.kohaTable = function(options={}, table_settings, add_filters, default_filters, filters_options, external_filter_nodes) { > > // Early return if the node does not exist > if (!this.length) return; >@@ -1037,17 +1036,16 @@ function _dt_save_restore_state(table_settings, external_filter_nodes={}){ > 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") >- }, >- }, options); >- > } > >+ var settings = $.extend(true, {}, dataTablesDefaults, { >+ "paging": true, >+ 'searching': true, >+ 'language': { >+ 'emptyTable': (options.emptyTable) ? options.emptyTable : __("No data available in table") >+ }, >+ }, options); >+ > settings["buttons"] = _dt_buttons({settings, table_settings}); > > if ( add_filters ) { >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js b/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js >index 7190e6ed0ac..1c786951a00 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js >@@ -275,8 +275,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; >@@ -290,17 +289,16 @@ 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") >- }, >- }, options); >- > } > >+ var settings = $.extend(true, {}, dataTablesDefaults, { >+ "paging": true, >+ 'searching': true, >+ 'language': { >+ 'emptyTable': (options.emptyTable) ? options.emptyTable : __("No data available in table") >+ }, >+ }, options); >+ > settings["buttons"] = _dt_buttons({settings, table_settings}); > > if ( table_settings ) { >-- >2.39.5
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