[Koha-patches] [PATCH] Bug 9459 - Use DataTables on hold ratios report page

Owen Leonard oleonard at myacpl.org
Wed Jan 23 17:05:43 CET 2013


Replace the tablesorter plugin with the DataTables plugin on the
hold ratios report page.

To test, open the hold ratios report (Circulation -> Hold ratios).
Confirm that table sorting works correctly.
---
 .../prog/en/modules/circ/reserveratios.tt          |   21 +++++++++-----------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt
index 33deaa9..e264ba7 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt
@@ -2,15 +2,12 @@
 <title>Koha › Circulation › Hold ratios</title>
 [% INCLUDE 'doc-head-close.inc' %]
 [% INCLUDE 'calendar.inc' %]
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
+<link rel="stylesheet" type="text/css" href="/intranet-tmpl/prog/en/css/datatables.css" />
+<script type="text/javascript" src="/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.dataTables.min.js"></script>
+[% INCLUDE 'datatables-strings.inc' %]
+<script type="text/javascript" src="/intranet-tmpl/prog/en/js/datatables.js"></script>
 <script type="text/javascript">
 //<![CDATA[
-$.tablesorter.addParser({
-    id: 'articles', 
-    is: function(s) {return false;  }, 
-    format: function(s) { return s.toLowerCase().replace(/^(the|an|a) /,''); }, 
-    type: 'text' 
-});
 	 $(document).ready(function() {
 	 	$("th a").hide();
 	 	$(".ratiolimit").click(function () {
@@ -20,11 +17,11 @@ $.tablesorter.addParser({
             function () { $(this).toggleClass("ulined") },
             function () { $(this).toggleClass("ulined") }
         );
-		$.tablesorter.defaults.widgets = ['zebra']; 
-		$("#holdst:has(tbody tr)").tablesorter({    // only add sort if the table has a body and rows
-			sortList: [[0,1]],
-			headers: { 1: { sorter: 'articles' }}
-        });
+        $("#holdst").dataTable($.extend(true, {}, dataTablesDefaults, {
+            "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
+            "iDisplayLength": 20,
+            "sPaginationType": "four_button"
+        }));
 	 });
 //]]>
 </script>
-- 
1.7.9.5


More information about the Koha-patches mailing list