Bug 9437 [Revised] Use DataTables on itemtypes administration page origin/new/bug_9437
authorOwen Leonard <oleonard@myacpl.org>
Sun, 20 Jan 2013 01:13:33 +0000 (20:13 -0500)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Thu, 7 Mar 2013 15:45:51 +0000 (10:45 -0500)
Replace the tablesorter plugin with the DataTables plugin on the
itemtypes administration page.

To test, open the itemtypes administration page (Administration
-> Item types). Confirm that table sorting works correctly.

Revision corrects template path to datatables assets.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: Sorting works. No errors.
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Amended patch: Delete an unused div block (used for pager).
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt

index 7b6000c..f21a998 100644 (file)
@@ -18,16 +18,10 @@ Data deleted
 [% END %]
 </title>
 [% INCLUDE 'doc-head-close.inc' %]
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.pager.js"></script>
-<script type="text/javascript" id="js">$(document).ready(function() {
-       // call the tablesorter plugin
-       $("#table_item_type").tablesorter({
-               sortList: [[1,0]],
-               headers: { 0: { sorter: false},5: { sorter: false}}
-                               }).tablesorterPager({container: $("#pagertable_item_type"),positionFixed: false,size: 10});
-       
-}); </script>
+<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>
 <script type="text/javascript">
 //<![CDATA[
 
@@ -86,6 +80,14 @@ function Check(f) {
 }
      $(document).ready(function() {
         $('#icons').tabs();
+        $("#table_item_type").dataTable($.extend(true, {}, dataTablesDefaults, {
+            "aoColumnDefs": [
+                { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
+            ],
+            "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
+            "aaSorting": [[ 2, "asc" ]],
+            "iDisplayLength": 10
+        }));
      });
 //]]>
 </script>
@@ -272,9 +274,7 @@ Item types administration
 
 [% IF ( else ) %]
 <h2>Item types administration</h2>
-[% IF ( loop ) %]<div id="pagertable_item_type">
-[% INCLUDE 'table-pager.inc' perpage='10' %]
-</div>
+[% IF ( loop ) %]
 <table id="table_item_type">
   <thead>
     [% UNLESS ( noItemTypeImages ) %]<th>Image</th>[% END %]