[Koha-patches] [PATCH] Bug 9430 - Use DataTables on library transfer limits page

Owen Leonard oleonard at myacpl.org
Fri Jan 18 21:01:00 CET 2013


Replace the tablesorter plugin with the DataTables plugin on the
library transfer limits page.

Also made minor changes to "check/uncheck all" function to prevent page
from jumping on click, and removed unused function.

To test, open the library transfer limits page (Administration ->
Library transfer limits). Confirm that table sorting works correctly for
all tables.

Test that the "check all/uncheck all" links still work correctly.
---
 .../en/modules/admin/branch_transfer_limits.tt     |   25 +++++++++++---------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branch_transfer_limits.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branch_transfer_limits.tt
index 1c2a7ac..f13b692 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branch_transfer_limits.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branch_transfer_limits.tt
@@ -1,15 +1,16 @@
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha › Administration › Library checkin and transfer policy</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 %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
 <script type="text/javascript">
 //<![CDATA[
 	$(document).ready(function(){
-		$("#CheckAll").click(function(){ $("#transferlimit_tabs").checkCheckboxes();});
-		$("#UncheckAll").click(function(){ $("#transferlimit_tabs").unCheckCheckboxes();});
-		$("#SwapAll").click(function(){ $("#transferlimit_tabs").toggleCheckboxes();});
+        $("#CheckAll").click(function(){ $("#transferlimit_tabs").checkCheckboxes(); return false; });
+        $("#UncheckAll").click(function(){ $("#transferlimit_tabs").unCheckCheckboxes(); return false; });
         $('#transferlimit_tabs').tabs();
 
 		 $('#branchselect').change(function() {
@@ -32,14 +33,17 @@
 			$("#"+tid).unCheckCheckboxes();
 			return false;
 		});
-		$(".sorted").tablesorter({
-			sortList: [[0,0]],
-			headers: { 1: { sorter: false}}
-		}).tablesorterPager({container: $(".pager"),positionFixed: false,size: 10});
+        $(".sorted").dataTable($.extend(true, {}, dataTablesDefaults, {
+            "aoColumnDefs": [
+                { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
+            ],
+            "iDisplayLength": 20,
+            "sPaginationType": "four_button"
+        }));
 	});
 //]]>
 </script>
-<style type="text/css">td { text-align: center; }</style>
+<style type="text/css">td { text-align: center; } .sorted { min-width: 50%; }</style>
 </head>
 <body id="admin_branch_transfer_limits" class="admin">
 [% INCLUDE 'header.inc' %]
@@ -85,7 +89,6 @@
     <p><a id="CheckAll[% codes_loo.code %]table" class="checkall" href="#">Check all</a> | <a id="UncheckAll[% codes_loo.code %]table" class="uncheckall" href="#">Uncheck all</a></p>
 	
 	<div id="pager[% codes_loo.code %]table">
-	[% INCLUDE 'table-pager.inc' perpage='20' %]
 	</div>
 		<table id="[% codes_loo.code %]table" class="sorted">
 			<thead>
-- 
1.7.9.5


More information about the Koha-patches mailing list