Bug 8099: DataTables integration in acquisition module [2]

acqui-home.tt

http://bugs.koha-community.org/show_bug.cgi?id=8099
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This commit is contained in:
Jonathan Druart 2012-02-17 15:55:18 +01:00 committed by Paul Poulain
parent 8a2139e495
commit 364b9a2da9
2 changed files with 37 additions and 0 deletions

View file

@ -220,6 +220,22 @@ function dt_overwrite_html_sorting_localeCompare() {
return (b > a) ? 1 : ((b < a) ? -1 : 0);
}
};
jQuery.fn.dataTableExt.oSort['num-html-asc'] = function(a,b) {
var x = a.replace( /<.*?>/g, "" );
var y = b.replace( /<.*?>/g, "" );
x = parseFloat( x );
y = parseFloat( y );
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
};
jQuery.fn.dataTableExt.oSort['num-html-desc'] = function(a,b) {
var x = a.replace( /<.*?>/g, "" );
var y = b.replace( /<.*?>/g, "" );
x = parseFloat( x );
y = parseFloat( y );
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
};
}
// Sorting on string without accentued characters

View file

@ -1,8 +1,15 @@
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Acquisitions</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.dataTables.min.js"></script>
[% INCLUDE 'datatables-strings.inc' %]
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
<script type="text/javascript">
//<![CDATA[
dt_overwrite_html_sorting_localeCompare();
$(document).ready(function() {
$('#showallbudgets').click(function() {
if ( $('#showallbudgets:checked').val() !== undefined) {
@ -18,6 +25,20 @@ $(document).ready(function() {
$('.bu_active').hide();
}
});
var srlt = $("#accounts").dataTable($.extend(true, {}, dataTablesDefaults, {
"aoColumns": [
null,
null,
null,
null,
{ "sType": "num-html" },
{ "sType": "num-html" },
null,
],
'bPaginate': false,
'bFilter': false,
'bInfo': false,
} ) );
});
//]]>
</script>