Bug 6838: Add pagination and filtering on subscriptions table
authorJulian Maurice <julian.maurice@biblibre.com>
Fri, 2 Sep 2011 14:30:18 +0000 (16:30 +0200)
committerPaul Poulain <paul.poulain@biblibre.com>
Mon, 13 Feb 2012 15:49:35 +0000 (16:49 +0100)
Use dataTables plugin

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
C4/Serials.pm
koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt

index 9cda52e..e9999db 100644 (file)
@@ -608,8 +608,6 @@ sub GetSubscriptions {
     $sth = $dbh->prepare($sql);
     $sth->execute(@bind_params);
     my @results;
-    my $previousbiblio = "";
-    my $odd           = 1;
 
     while ( my $line = $sth->fetchrow_hashref ) {
         $line->{'cannotedit'} =
index fb310d5..ec1faf3 100644 (file)
@@ -1,18 +1,22 @@
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Serials [% biblionumber %]</title>
+<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
 [% 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.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() {
-        $("#srlt").tablesorter({
-            headers: {
-                2: { sorter: false },
-                4: { sorter: false },
-                               5: { sorter: false }
-            }
-        }); 
- }); 
+    var srlt = $("#srlt").dataTable($.extend(true, {}, dataTablesDefaults, {
+        "aoColumnDefs": [
+            { "aTargets": [ -1, -2, -3 ], "bSortable": false, "bSearchable": false },
+        ],
+        "sPaginationType": "four_button"
+    } ) );
+
+    srlt.fnAddFilters("filter", 750);
+ });
  //]]>
 </script>
 </head>
@@ -85,16 +89,24 @@ Serials updated :
             [% IF ( routing ) %]
               <th>Routing list</th>
             [% END %]        
-            <th colspan="2">&nbsp;</th>
+            <th>&nbsp;</th>
+            <th>&nbsp;</th>
         </tr>
        </thead>
+    <tfoot>
+        <tr>
+            <td><input type="text" class="filter" data-column_num="0" placeholder="Search ISSN" /></td>
+            <td><input type="text" class="filter" data-column_num="1" placeholder="Search title" /></td>
+            <td><input type="text" class="filter" data-column_num="2" placeholder="Search notes" /></td>
+            <td><input type="text" class="filter" data-column_num="3" placeholder="Search library" /></td>
+            <td></td>
+            <td></td>
+            <td></td>
+        </tr>
+    </tfoot>
        <tbody> 
         [% FOREACH subscription IN subscriptions %]
-        [% UNLESS ( loop.odd ) %]
-            <tr class="highlight">
-        [% ELSE %]
             <tr>
-        [% END %]
                 <td>
                 [% IF ( subscription.issn ) %][% subscription.issn %]
                 [% END %]