[#133] Custom reports respect sorting in SQL

This commit is contained in:
Oliver Gorwits
2014-11-16 22:29:11 +00:00
parent f6ae7be611
commit a8208121c2
4 changed files with 13 additions and 0 deletions

View File

@@ -9,6 +9,7 @@
* [#162] Change from Net::MAC to NetAddr::MAC * [#162] Change from Net::MAC to NetAddr::MAC
* [#159] Macsuck archive behaviour same as ND1 (unseen nodes remain active) * [#159] Macsuck archive behaviour same as ND1 (unseen nodes remain active)
* [#170] Show device SNMP::Info class in web interface * [#170] Show device SNMP::Info class in web interface
* [#133] Custom reports respect sorting in SQL
* Add "Run Expire Job" to the Admin Menu * Add "Run Expire Job" to the Admin Menu
[BUG FIXES] [BUG FIXES]

View File

@@ -55,6 +55,7 @@ foreach my $report (@{setting('reports')}) {
if (request->is_ajax) { if (request->is_ajax) {
template 'ajax/report/generic_report.tt', template 'ajax/report/generic_report.tt',
{ results => \@results, { results => \@results,
is_custom_report => true,
headings => [map {values %{$_}} @{$report->{columns}}], headings => [map {values %{$_}} @{$report->{columns}}],
columns => [map {keys %{$_}} @{$report->{columns}}] }, columns => [map {keys %{$_}} @{$report->{columns}}] },
{ layout => undef }; { layout => undef };

View File

@@ -8,4 +8,14 @@
"search": '_INPUT_', "search": '_INPUT_',
"searchPlaceholder": 'Filter records...', "searchPlaceholder": 'Filter records...',
"lengthMenu": "Show _MENU_ records." "lengthMenu": "Show _MENU_ records."
},
"stateSaveParams": function (settings, data) {
// make sure filter is never saved
data.search.search = "";
// make sure paging position is not saved
data.start = 0;
[% IF is_custom_report %]
// disable sorting for custom reports
data.order = "";
[% END %]
} }

View File

@@ -20,6 +20,7 @@
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('#rg-data-table').dataTable({ $('#rg-data-table').dataTable({
"order": [],
[% INCLUDE 'ajax/datatabledefaults.tt' -%] [% INCLUDE 'ajax/datatabledefaults.tt' -%]
} ); } );
} ); } );