Bug 9473: Use DataTables on tags list page
authorOwen Leonard <oleonard@myacpl.org>
Wed, 23 Jan 2013 21:04:39 +0000 (16:04 -0500)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Thu, 7 Feb 2013 12:48:05 +0000 (07:48 -0500)
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.

Revision makes default result count (20) match options for number of
pagination entries (10,20,50,100,all).

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt

index e9c683a..f0d70be 100644 (file)
@@ -1,15 +1,12 @@
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Tools &rsaquo; Tags &rsaquo; [% IF ( do_it ) %]Review &rsaquo; [% 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");
                     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, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
+            "iDisplayLength": 20,
+            "sPaginationType": "four_button"
+        }));
     });
 //]]>
 </script>