[Koha-patches] [PATCH] Bug 9473 - Use DataTables on tags list page

Owen Leonard oleonard at myacpl.org
Wed Jan 23 22:06:57 CET 2013


Replace the tablesorter plugin with the DataTables plugin on the tags
list page.

To test, got to tags moderation and click on a term which tags
multiple titles. On the tags list page, confirm that table sorting works
correctly.
---
 .../intranet-tmpl/prog/en/modules/tags/list.tt     |   24 +++++++++++---------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt
index e9c683a..390b7ae 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt
@@ -1,15 +1,12 @@
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha › Tools › Tags › [% IF ( do_it ) %]Review › [% ELSE %]Review tags[% END %]</title>
 [% INCLUDE 'doc-head-close.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() {
         $(".delete").click(function (event) {
             $(this).parent().parent().parent().addClass("selected");
@@ -19,10 +16,15 @@
                     event.preventDefault();
                 }
         });
-        $("#itemst").tablesorter({
-            sortList: [[0,0]],
-            headers: { 0: { sorter: 'articles' },1: { sorter: false },2:{sorter:false}}
-        });
+        $("#itemst").dataTable($.extend(true, {}, dataTablesDefaults, {
+            "aoColumnDefs": [
+                { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
+            ],
+            "aaSorting": [[ 0, "asc" ]],
+            "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