[Bug 34907] New: Load datatables on CMS pages
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34907 Bug ID: 34907 Summary: Load datatables on CMS pages Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Tools Assignee: koha-bugs@lists.koha-community.org Reporter: lisette.scheer@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org It would be nice we loaded/could optionally load datatables on custom pages for table consistency. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34907 Owen Leonard <oleonard@myacpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |master -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34907 Mathieu Saby <mathsabypro@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mathsabypro@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34907 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34907 Jason Robb <jrobb@sekls.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jrobb@sekls.org --- Comment #1 from Jason Robb <jrobb@sekls.org> --- We currently link in datatables via their cdn on custom OPAC pages where we want to neatly display public report data. With the introduction of bug #38365 in 26.05, it sounds like that will break. It would be nice to see this bug move along so we can leverage Koha's built-in datatables when building custom pages instead of relying on the external source. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34907 Brendan Lawlor <blawlor@clamsnet.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |blawlor@clamsnet.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34907 koha-US bug tracker <bugzilla@koha-us.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@koha-us.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34907 Sally <sally.healey@cheshiresharedservices.gov.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sally.healey@cheshireshared | |services.gov.uk -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34907 --- Comment #2 from Brendan Lawlor <blawlor@clamsnet.org> --- (In reply to Jason Robb from comment #1)
We currently link in datatables via their cdn on custom OPAC pages where we want to neatly display public report data.
With the introduction of bug #38365 in 26.05, it sounds like that will break.
It would be nice to see this bug move along so we can leverage Koha's built-in datatables when building custom pages instead of relying on the external source.
I'm interested in how you're doing this now and how it works in general. I worked out a basic example you can copy and paste into an intranet page that doesn't use the cdn. It loads Koha's bundled datatables.js (in the example just replace intranet-tmpl with opac-tmpl for opac pages) I found that page.tt loads jquery in the footer, so any script embeded in the custom page runs before jquery is available. The trick is to add an event listener for DOMContentLoaded and then inject the datatables.js script in a script inside the head element. When that script loads initialize the datatable. This might be a workaround for your existing pages, and also may help with the enhancement to integrate datatables into Koha custom pages too :) code: <p>This page has a script to initialize a data table</p> <link href="/intranet-tmpl/lib/datatables/datatables.min.css" rel="stylesheet" /> <table id="example-dt" class="table"> <thead> <tr> <th>code</th> <th>data</th> </tr> </thead> <tbody> <tr> <td>A</td> <td>123</td> </tr> <tr> <td>B</td> <td>42</td> </tr> <tr> <td>C</td> <td>999</td> </tr> <tr> <td>D</td> <td>67</td> </tr> </tbody> </table> <script> document.addEventListener('DOMContentLoaded', function () { var s = document.createElement('script'); s.src = '/intranet-tmpl/lib/datatables/datatables.min.js'; s.onload = function () { $('#example-dt').DataTable(); }; document.head.appendChild(s); }); </script> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org