From cc2b0953426b1d8690cca17798d2fab0d4506a8d Mon Sep 17 00:00:00 2001 From: Olivier Hubert Date: Wed, 26 Oct 2022 12:29:20 -0400 Subject: [PATCH] Bug 31994: DataTable next button does not work when using data in the HTML This patch resolves the issue that occurs when the next button of a DataTable with data straight from the HTML is clicked. Test plan: 1. Run the following SQL query on the database: DELETE FROM tables_settings WHERE tablename = 'table_item_type'; 2. Restart plack / memcached if using. 3. Open itemtypes.pl. 4. If there are fewer than 11 item types, create additional item types until there are more than 10, so that the next button can be used. 5. Click on the next button / link. 6. Notice that nothing happens. 7. Apply the patch. 8. Restart plack / memcached if using. 9. Reload itemtypes.pl. 10. Click on the next button / link. 11. Notice that the next page is displayed. Signed-off-by: Magnus Enger I can reproduce the problem on ktd, after a restart_all and a hard reload of itemtypes.pl. Patch fixes the problem. Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi (cherry picked from commit e23d4d0e6adbd1b2c48fa8c235953b8f642ad032) Signed-off-by: Jacob O'Mara --- koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 32783ed6c8..db3987bbdd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc @@ -203,7 +203,8 @@ function KohaTable(id_selector, dt_parameters, table_settings, add_filters) { if ( table_settings ) { if ( table_settings.hasOwnProperty('default_display_length') && table_settings['default_display_length'] != null ) { - new_parameters["pageLength"] = table_settings['default_display_length']; + // pageLength needs to be a number, not a string, or it can cause issues with DataTable's next button. + new_parameters["pageLength"] = parseInt(table_settings['default_display_length']); } if ( table_settings.hasOwnProperty('default_sort_order') && table_settings['default_sort_order'] != null ) { new_parameters["order"] = [[ table_settings['default_sort_order'], 'asc' ]]; -- 2.39.5