[Koha-patches] [PATCH] Bug 9877 - Use DataTables on funds administration page

Owen Leonard oleonard at myacpl.org
Wed Mar 20 20:25:17 CET 2013


Replace the tablesorter plugin with the DataTables plugin on the funds
administration page.

To test, open the funds administration page (Administration ->
Funds). Confirm that table sorting, paging, and searching works
correctly.

Note that the table is sorted only when hierarchical display of parent
and child funds is not enabled. When the hierarchicial display is
enabled the table sorter is not triggered.
---
 .../prog/en/modules/admin/aqbudgets.tt             |   25 +++++++++++++-------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt
index af0f086..3a7a6e1 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt
@@ -136,10 +136,16 @@
 //]]>
 </script>
 [% ELSE %]
-<link href="[% themelang %]/lib/jquery/plugins/treetable/stylesheets/jquery.treeTable.css" rel="stylesheet" type="text/css" />
+    [% IF ( notree ) %]
+        <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
+        <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
+        [% INCLUDE 'datatables-strings.inc' %]
+        <script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
+    [% ELSE %]
+        <link href="[% themelang %]/lib/jquery/plugins/treetable/stylesheets/jquery.treeTable.css" rel="stylesheet" type="text/css" />
+        <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/treetable/jquery.treeTable.min.js"></script>
+    [% END %]
 
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/treetable/jquery.treeTable.min.js"></script>
 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.qtip.js"></script>
 
 <script type="text/javascript">
@@ -174,11 +180,14 @@
             }
         });
         [% IF ( notree ) %]
-        $("#budgeth").tablesorter({
-            widgets : ['zebra'],
-            sortList: [[0,0]],
-            headers: { 7: { sorter: false }}
-        });
+            $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
+                "aoColumnDefs": [
+                    { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
+                ],
+                "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
+                "iDisplayLength": 20,
+                "sPaginationType": "four_button"
+            }));
         [% ELSE %]
         $("#budgeth").treeTable();
         [% END %]
-- 
1.7.9.5


More information about the Koha-patches mailing list