[Koha-patches] [PATCH] Bug 9435 - Use DataTables on libraries and groups administration page

Owen Leonard oleonard at myacpl.org
Sun Jan 20 01:28:02 CET 2013


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.
---
 .../prog/en/modules/admin/branches.tt              |   30 +++++++++++++-------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt
index 15e8064..bb70cc0 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt
@@ -11,10 +11,22 @@
 [% 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="/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" src="[% themelang %]/js/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
-<script language="javascript" type="text/javascript">
+<script type="text/javascript">
+//<![CDATA[
+    $(document).ready(function() {
+        $("#branchest").dataTable($.extend(true, {}, dataTablesDefaults, {
+            "aoColumnDefs": [
+                { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
+            ],
+            "iDisplayLength": 10,
+            "sPaginationType": "four_button"
+        }));
+    });
 tinyMCE.init({
     mode : "textareas",
     theme : "advanced",
@@ -31,6 +43,7 @@ tinyMCE.init({
     height : "300",
     width : "700"
 });
+//]]>
 </script>
 </head>
 <body id="admin_branches" class="admin">
@@ -66,12 +79,7 @@ tinyMCE.init({
 
 	 $(document).ready(function() {
 	    yuiToolbar();
-		$.tablesorter.defaults.widgets = ['zebra']; 
-		$("#branchest").tablesorter({
-			sortList: [[0,0]],
-			headers: { 3:{sorter:false},4:{sorter:false},5:{sorter:false},6:{sorter:false}}
-		}).tablesorterPager({container: $("#pagerbranchest"),positionFixed: false,size: 10}); 
-		}); 
+    });
 	// YUI Toolbar Functions
 
 	function yuiToolbar() {
@@ -189,7 +197,6 @@ tinyMCE.init({
     [% 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>
@@ -199,7 +206,8 @@ tinyMCE.init({
             <th>Properties</th>
             <th>IP</th>
             <!-- <th>Printer</th> -->
-            <th colspan="2"> </th>
+            <th> </th>
+            <th> </th>
         </tr></thead><tbody>
         [% FOREACH branche IN branches %]
 	[% IF ( loop.odd ) %]
-- 
1.7.10.4



More information about the Koha-patches mailing list