Bug 38827 - New search performed when column filters lose focus
Summary: New search performed when column filters lose focus
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal
Assignee: Jonathan Druart
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-06 09:46 UTC by Jonathan Druart
Modified: 2025-01-26 22:12 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes DataTable tables to stop duplicate update queries being made when values are entered for filters and then the focus is lost (for example, clicking somewhere else on the screen).
Version(s) released in:
25.05.00
Circulation function:


Attachments
Bug 38827: DataTables - Do not filter when inputs lose focus (1.58 KB, patch)
2025-01-06 09:52 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 38827: DataTables - Do not filter when inputs lose focus (1.63 KB, patch)
2025-01-06 16:08 UTC, Jake Deery
Details | Diff | Splinter Review
Bug 38827: DataTables - Do not filter when inputs lose focus (1.69 KB, patch)
2025-01-07 15:35 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2025-01-06 09:46:54 UTC
On a table using DataTables and the REST API wrapper with the column filters, if one input is used to filter the table the query will be made twice: when the user stopped typing and when the input will lose the focus.
Comment 1 Jonathan Druart 2025-01-06 09:52:49 UTC
Created attachment 176147 [details] [review]
Bug 38827: DataTables - Do not filter when inputs lose focus

On a table using DataTables and the REST API wrapper with the column
filters, if one input is used to filter the table the query will be made
twice: when the user stopped typing and when the input will lose the
focus.

Test plan:
Search for patron
Open the dev console, "Network" tab
In the "Card" column filter enter "0000"
Notice that the table is filtered and that a request has been made
Click outside of the "Card" input
=> Without this patch another request (the same) is made and the table
updated
=> With this patch applied no request is made when the input loses the
focus.
Comment 2 Jake Deery 2025-01-06 16:08:58 UTC
Created attachment 176162 [details] [review]
Bug 38827: DataTables - Do not filter when inputs lose focus

On a table using DataTables and the REST API wrapper with the column
filters, if one input is used to filter the table the query will be made
twice: when the user stopped typing and when the input will lose the
focus.

Test plan:
Search for patron
Open the dev console, "Network" tab
In the "Card" column filter enter "0000"
Notice that the table is filtered and that a request has been made
Click outside of the "Card" input
=> Without this patch another request (the same) is made and the table
updated
=> With this patch applied no request is made when the input loses the
focus.

Signed-off-by: Jake Deery <jake.deery@ptfs-europe.com>
Comment 3 Jake Deery 2025-01-06 16:09:22 UTC
Worked for me, nice optimisation.

Jake.
Comment 4 Martin Renvoize (ashimema) 2025-01-07 15:35:52 UTC
Created attachment 176197 [details] [review]
Bug 38827: DataTables - Do not filter when inputs lose focus

On a table using DataTables and the REST API wrapper with the column
filters, if one input is used to filter the table the query will be made
twice: when the user stopped typing and when the input will lose the
focus.

Test plan:
Search for patron
Open the dev console, "Network" tab
In the "Card" column filter enter "0000"
Notice that the table is filtered and that a request has been made
Click outside of the "Card" input
=> Without this patch another request (the same) is made and the table
updated
=> With this patch applied no request is made when the input loses the
focus.

Signed-off-by: Jake Deery <jake.deery@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Katrin Fischer 2025-01-10 17:00:43 UTC
Pushed for 25.05!

Well done everyone, thank you!