Bug 9435 [Revised] Use DataTables on libraries and groups administration page
authorOwen Leonard <oleonard@myacpl.org>
Sun, 20 Jan 2013 00:00:34 +0000 (19:00 -0500)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Thu, 7 Mar 2013 15:56:10 +0000 (10:56 -0500)
Replace the tablesorter plugin with the DataTables plugin on the
libraries and groups administration page.

To test, open the libraries and groups administration page (Administration
-> Libraries and groups). Confirm that table sorting works correctly.

Revision corrects template path to datatables assets.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: Sort works. No errors.
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Amended patch: Add the aLengthMenu key for DataTables + 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/branches.tt

index 7cd4b65..4404e28 100644 (file)
 [% 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>
+<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" src="[% themelang %]/js/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
 <script type="text/javascript">
+//<![CDATA[
+    $(document).ready(function() {
+        $("#branchest").dataTable($.extend(true, {}, dataTablesDefaults, {
+            "aoColumnDefs": [
+                { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
+            ],
+            "iDisplayLength": 10,
+            "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
+            "sPaginationType": "four_button"
+        }));
+    });
 tinyMCE.init({
     mode : "textareas",
     theme : "advanced",
@@ -31,6 +44,7 @@ tinyMCE.init({
     height : "300",
     width : "700"
 });
+//]]>
 </script>
 </head>
 <body id="admin_branches" class="admin">
@@ -165,9 +179,6 @@ tinyMCE.init({
     [% IF ( MESSAGE10 ) %]<div class="dialog message">Library cannot be deleted because there are items held by that library</div>[% END %]
     [% IF ( MESSAGE11 ) %]<div class="dialog message">Library cannot be deleted because there are patrons registered at that library</div>[% END %]
 [% IF ( branches ) %]
-<div id="pagerbranchest">
-[% INCLUDE 'table-pager.inc' perpage='10' %]
-</div>
     <table id="branchest">
 <thead><tr>
                        <th>Name</th>
@@ -176,7 +187,8 @@ tinyMCE.init({
             <th>Properties</th>
             <th>IP</th>
             <!-- <th>Printer</th> -->
-            <th colspan="2">&nbsp;</th>
+            <th>&nbsp;</th>
+            <th>&nbsp;</th>
         </tr></thead><tbody>
         [% FOREACH branche IN branches %]
        [% IF ( loop.odd ) %]