[Koha-patches] [PATCH] Bug 9429 - Use DataTables on Authorized Values page

Owen Leonard oleonard at myacpl.org
Fri Jan 18 20:31:46 CET 2013


Replace the tablesorter plugin with the DataTables plugin on the
Authorized Values page.

To test, open the Authorized Values page (Administration -> Authorized
values). Confirm that table sorting works correctly.
---
 .../prog/en/modules/admin/authorised_values.tt     |   35 +++++++++++---------
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt
index e464617..8ca653d 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt
@@ -5,27 +5,31 @@
 [% IF ( delete_confirm ) %] › Confirm deletion[% END %]
 [% IF ( else ) %]Authorized values[% 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_authorized_values").tablesorter({
-		sortList: [[1,0]],
-		headers: { 4: { sorter: false}, 5: { sorter: false}}
-		   		}).tablesorterPager({container: $("#pagertable_authorized_values"),positionFixed: false,size: 50});
+
+<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[
+ $(document).ready(function() {
+    $("#table_authorized_values").dataTable($.extend(true, {}, dataTablesDefaults, {
+        "aoColumnDefs": [
+            { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
+        ],
+        "aaSorting": [[ 1, "asc" ]],
+        "iDisplayLength": 20,
+        "sPaginationType": "four_button"
+    }));
 
     if ( $("#branches option:selected").length < 1 ) {
         $("#branches option:first").attr("selected", "selected");
     }
-}); </script>
-
-<script type="text/JavaScript" language="JavaScript">
-//<![CDATA[
-     $(document).ready(function() {
-        $('#icons').tabs();
-     });
+    $('#icons').tabs();
+});
 //]]>
 </script>
+
 <style type="text/css">
 	fieldset.rows div.toptabs li { clear:none;margin-right:.5em;padding-bottom:0;width:auto; }
     fieldset.rows div.toptabs .ui-tabs-nav li.ui-tabs-selected {background-color : #F4F8F9; }
@@ -244,7 +248,6 @@
 <h3>Authorized values for category [% category %]:</h3>
 
 [% IF ( loop ) %]<div id="pagertable_authorized_values">
-[% INCLUDE 'table-pager.inc' perpage='50' %]
 </div>[% END %]
 
 [% IF ( loop ) %]<table id="table_authorized_values" class="tablesorter">
-- 
1.7.9.5


More information about the Koha-patches mailing list