Bug 31994 - Clicking the next button of a DataTable loading its data from the HTML does nothing
Summary: Clicking the next button of a DataTable loading its data from the HTML does n...
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Olivier Hubert
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-26 16:25 UTC by Olivier Hubert
Modified: 2023-12-28 20:44 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.05


Attachments
Bug 31994: DataTable next button does not work when using data in the HTML (1.95 KB, patch)
2022-10-26 16:35 UTC, Olivier Hubert
Details | Diff | Splinter Review
Bug 31994: DataTable next button does not work when using data in the HTML (2.10 KB, patch)
2023-01-31 18:36 UTC, Olivier Hubert
Details | Diff | Splinter Review
Bug 31994: DataTable next button does not work when using data in the HTML (2.27 KB, patch)
2023-03-29 10:28 UTC, Magnus Enger
Details | Diff | Splinter Review
Bug 31994: DataTable next button does not work when using data in the HTML (2.32 KB, patch)
2023-03-29 14:59 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Hubert 2022-10-26 16:25:47 UTC
When the next button of a DataTable with data straight from the HTML is clicked, nothing happens. Additionally, an error can be found in the console similar to:

Uncaught TypeError: q is undefined

Note that this problem does not occur when the data is sourced using Ajax.

Steps to reproduce:
1. Open itemtypes.pl.
2. 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.
3. Click on the next button / link.
4. Notice that nothing happens.
Comment 1 Olivier Hubert 2022-10-26 16:35:36 UTC Comment hidden (obsolete)
Comment 2 E-P Keskitalo 2022-10-28 08:26:10 UTC
Cannot reproduce. Works as expected in the current sandbox version without applying the patch.
Comment 3 David Nind 2022-10-28 23:43:35 UTC
I can reproduce this bug on the latest 21.11 and 21.05.

I checked these versions:
- master: can't reproduce (works as expected)
- 22.05: can't reproduce (works as expected)
- 21.11: can reproduce
- 21.05: can reproduce
- 20.11: can't reproduce (works as expected)
Comment 4 David Nind 2022-10-28 23:58:06 UTC Comment hidden (obsolete)
Comment 5 Lucas Gass 2022-12-06 16:30:47 UTC
Olivier,

I am also unable to reproduce this issue in either master or 21.11. Your patch applies cleanly in master but does not in 21.11.x 


Can you confirm which version your patch is intended for?
Comment 6 Olivier Hubert 2022-12-07 17:16:56 UTC
Hi Lucas,

The patch is intended for master only. I have not tested it on any other version so far.

I confirm that I am able to reproduce the issue on a clean master, and that applying the patch fixes the issue.

However, I can confirm that the bug cannot be reproduced on a Bywater sandbox. I don't understand how that is possible, since the master branch should be the same, as long as it's up-to-date.

We run all of our tests on local installations, not using docker images. Do you know if there are differences between the master branch and the version available through KTD?
Comment 7 Olivier Hubert 2022-12-07 17:28:51 UTC
I figured it out. The problem only occurs if the Default Display Length was never updated through column_settings.pl. When that is the case, the default display length is used, and that variable is a string, not an int, therefore causing the issue.

To reproduce, add the following before Step 3 of the test plan:
2a: Run the following SQL query:
  DELETE FROM tables_settings WHERE tablename = 'table_item_type';

If someone can confirm reproduction on master, I will update the test plan accordingly.
Comment 8 David Nind 2023-01-12 00:23:14 UTC
(In reply to Olivier Hubert from comment #7)
> If someone can confirm reproduction on master, I will update the test plan
> accordingly.

Hi Olivier.

I was able to reproduce on the current master (using koha-testing-docker), here is what I did:

1. Followed steps 1-2 in the current test plan.

2. Followed new step 2a.

3. Ran a flush_memcached, restart_all, and cleared the browser cache.[1]

4. The first time I go to Administration > Basic parameters > Item types the behavour as identified occurs. That is, clicking on Next or Last options don't work (from both at the top and bottom of the table).

5. If I click on the menu in the sidebar again (Item types) to refresh the page, then the Next and Last options work as expected.

6. I applied the patch and followed the rest of the test plan, and this resolved the issue.

I'm happy to sign off once you have updated the test plan.

Thanks for persevering with this!

David


[1] Clearing the browser cache: I normally use the Firefox Developer Edition, and have set things so that all history, etc., are deleted when it is closed.
Comment 9 Olivier Hubert 2023-01-31 18:36:07 UTC Comment hidden (obsolete)
Comment 10 Magnus Enger 2023-03-29 10:28:56 UTC
Created attachment 148899 [details] [review]
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 <magnus@libriotech.no>
I can reproduce the problem on ktd, after a restart_all and a
hard reload of itemtypes.pl. Patch fixes the problem.
Comment 11 Nick Clemens (kidclamp) 2023-03-29 14:59:08 UTC
Created attachment 148930 [details] [review]
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 <magnus@libriotech.no>
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 <nick@bywatersolutions.com>
Comment 12 Tomás Cohen Arazi 2023-04-06 13:04:04 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 13 Jacob O'Mara 2023-04-16 20:37:13 UTC
Nice work, thanks everyone!

Pushed to 22.11.x for the next release.