[Koha-patches] [PATCH] Bug 9476 - Use Datatables on Koha news page

Owen Leonard oleonard at myacpl.org
Thu Jan 24 02:44:27 CET 2013


Replace the tablesorter plugin with the DataTables plugin on the
Koha news page.

To test, open the Koha news page (Tools -> News). Confirm that table sorting
works correctly.
---
 .../prog/en/modules/tools/koha-news.tt             |   22 +++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt
index f782897..d1148b5 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt
@@ -2,17 +2,25 @@
 <title>Koha › Tools › News</title>
 [% INCLUDE 'doc-head-close.inc' %]
 [% INCLUDE 'calendar.inc' %]
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
+[% IF ( opac_news_count ) %]
+<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[
+[% IF (dateformat == 'metric') %]dt_add_type_uk_date();[% END %]
 $(document).ready(function() {
-	$("#newst").tablesorter({[% IF ( dateformat == 'metric' ) %]
-		dateFormat: 'uk',[% END %]
-		sortList: [[2,0]],
-		headers: { 0: {sorter:false},6: { sorter: false },7: { sorter: false }}
-	}); 
-}); 
+    $("#newst").dataTable($.extend(true, {}, dataTablesDefaults, {
+        "sDom": 't',
+        "aoColumnDefs": [
+            { "aTargets": [ 0,-1,-2 ], "bSortable": false, "bSearchable": false }
+        ],
+        "bPaginate": false
+    }));
+});
 //]]>
 </script>
+[% END %]
 <script language="javascript" type="text/javascript" src="[% themelang %]/js/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
 <script language="javascript" type="text/javascript">
 tinyMCE.init({
-- 
1.7.10.4


More information about the Koha-patches mailing list