DataTables for access point channel distribution report
This commit is contained in:
@@ -1,17 +1,29 @@
|
||||
<table class="table table-bordered table-condensed table-striped nd_floatinghead">
|
||||
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="nd_center-cell">Channel</th>
|
||||
<th class="nd_center-cell">Count</th>
|
||||
<th>Channel</th>
|
||||
<th>Count</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</tbody>
|
||||
[% WHILE (row = results.next) %]
|
||||
<tr>
|
||||
<td class="nd_center-cell">[% row.channel %]</td>
|
||||
<td class="nd_center-cell">[% row.get_column('ch_count') %]</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
var table = $('#data-table').dataTable({
|
||||
"deferRender": true,
|
||||
"order": [[ 1, "desc" ]],
|
||||
"data": [% results %],
|
||||
"columns": [
|
||||
{
|
||||
"data": 'channel'
|
||||
}, {
|
||||
"data": 'ch_count',
|
||||
"searchable": false,
|
||||
"render": function(data, type, full, meta) {
|
||||
return data.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
[% USE CSV -%]
|
||||
[% CSV.dump([ 'Channel' 'Count' ]) %]
|
||||
|
||||
[% WHILE (row = results.next) %]
|
||||
[% FOREACH row IN results %]
|
||||
[% mylist = [] %]
|
||||
[% mylist.push(row.channel) %]
|
||||
[% mylist.push(row.get_column('ch_count')) %]
|
||||
[% mylist.push(row.ch_count) %]
|
||||
[% CSV.dump(mylist) %]
|
||||
|
||||
[% END %]
|
||||
|
||||
Reference in New Issue
Block a user