[Koha-patches] [PATCH] Bug 9444 - Use DataTables in system preferences editor

Owen Leonard oleonard at myacpl.org
Tue Jan 22 18:20:57 CET 2013


Replace the tablesorter plugin with the DataTables plugin in the
"new" system preferences editor.

To test, open the system preferences editor on any tab other than Local
Use. Confirm that table sorting works correctly within each section. In
this configuration there should be no pager and no results filtering.
---
 .../intranet-tmpl/prog/en/js/pages/preferences.js  |   11 +++++++----
 .../prog/en/modules/admin/preferences.tt           |    5 ++++-
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js b/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js
index 4d793a1..57f8dd3 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js
+++ b/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js
@@ -1,8 +1,11 @@
 $(document).ready(function() {
-    $("table.preferences").tablesorter({
-        sortList: [[0,0]],
-        headers: { 1: { sorter:false}}
-    });
+    $("table.preferences").dataTable($.extend(true, {}, dataTablesDefaults, {
+        "sDom": 't',
+        "aoColumnDefs": [
+            { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }
+        ],
+        "bPaginate": false
+    }));
 });
 
 // We can assume 'KOHA' exists, as we depend on KOHA.AJAX
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt
index 139c35e..58c1098 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt
@@ -1,7 +1,10 @@
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha › Administration › System preferences</title>
 [% INCLUDE 'doc-head-close.inc' %]
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.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>
 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/preferences.css" />
 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
 <script type="text/javascript">
-- 
1.7.9.5


More information about the Koha-patches mailing list