Bug 10634 - Use datatables for course details items table
authorKyle M Hall <kyle@bywatersolutions.com>
Tue, 23 Jul 2013 16:39:03 +0000 (12:39 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Wed, 4 Sep 2013 14:19:03 +0000 (14:19 +0000)
We should make the course items table in the course details a datatable
to enable searching or sorting.

Test Plan:
1) Apply this patch
2) View the details page for a course with items
3) Verify the table displays and is now a datatable

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt

index 08953f2..5e69702 100644 (file)
@@ -5,9 +5,22 @@
 <title>Koha &rsaquo; Course reserves &rsaquo; Course details for [% course.course_name %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
 
+<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
+<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
+[% INCLUDE 'datatables-strings.inc' %]
+<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
 <script type="text/javascript">
 //<![CDATA[
     $(document).ready(function(){
+        $("#course_reserves_table").dataTable($.extend(true, {}, dataTablesDefaults, {
+            "sPaginationType": "four_button",
+            "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
+            "iDisplayLength": 20,
+            "aoColumnDefs": [
+                { 'bSortable': false, 'aTargets': [ 9, 10, 11 ] }
+            ]
+        }));
+
         $("a.delete_item").click(function(){
             return confirm( _("Are you sure you want to remove this item from the course?"));
         });
@@ -56,7 +69,7 @@
             </div>
 
             [% IF course_reserves %]
-            <table>
+            <table id="course_reserves_table">
                 <caption>Reserves</caption>
                 <thead>
                     <tr>