Bug 7567: (follow-up) Modify DataTables configuration

This follow-up corrects a JavaScript error by converting the sorting
configuration to be class-based
(http://wiki.koha-community.org/wiki/DataTables_HowTo#Sorting_dates_regardless_of_date_format_preference).

I have also changed the DataTables configuration to allow for pagination
and JS-based filtering.

To test, apply the patch and view the list of News items. Your browser
should report no JavaScript errors. Table sorting, pagination, and
filtering should work correctly.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Owen Leonard 2014-03-27 09:30:24 -04:00 committed by Galen Charlton
parent ab47d48488
commit 8d4d4550aa
1 changed files with 6 additions and 9 deletions

View File

@ -9,14 +9,11 @@
<script type="text/javascript">//<![CDATA[
$(document).ready(function() {
$("#newst").dataTable($.extend(true, {}, dataTablesDefaults, {
"sDom": 't',
"aoColumnDefs": [
{ "aTargets": [ 0,-1,-2 ], "bSortable": false, "bSearchable": false }
{ "aTargets": [ 0,-1,-2 ], "bSortable": false },
{ "aTargets": [ 0, -1 ], "bSearchable": false },
{ 'sType': "title-string", 'aTargets' : [ 'title-string'] }
],
"aoColumns": [
null,null,null,{ "sType": "title-string" },{ "sType": "title-string" },null,null,null
],
"bPaginate": false
}));
});
//]]>
@ -64,7 +61,7 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div>
[% UNLESS ( add_form ) %]
<div id="toolbar" class="btn-toolbar">
<a class="btn btn-small" id="newentry" href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&lang=[% lang %]"><i class="icon-plus"></i> New entry</a>
<a class="btn btn-small" id="newentry" href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&amp;lang=[% lang %]"><i class="icon-plus"></i> New entry</a>
</div>
[% END %]
@ -208,8 +205,8 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div>
<th>Location</th>
<th>Library</th>
<th>Number</th>
<th>Creation date</th>
<th>Expiration date</th>
<th class="title-string">Creation date</th>
<th class="title-string">Expiration date</th>
<th>Title</th>
<th>News</th>
<th>&nbsp;</th>