1[% USE Number.Format %] 2[% IF opt %] 3 <table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0"> 4 <thead> 5 <tr> 6 <th>Device (Port)</th> 7 <th>Broadcast</th> 8 <th>Model</th> 9 <th>SSID</th> 10 <th>Vendor</th> 11 </tr> 12 </thead> 13 </table> 14[% ELSE %] 15 <table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0"> 16 <thead> 17 <tr> 18 <th class="nd_center-cell">SSID</th> 19 <th class="nd_center-cell">Broadcast</th> 20 <th class="nd_center-cell">Count</th> 21 </tr> 22 </thead> 23 </table> 24[% END %] 25 26<script type="text/javascript"> 27$(document).ready(function() { 28 var table = $('#data-table').dataTable({ 29 "deferRender": true, 30 "data": [% results | none %], 31 [% IF opt %] 32 "columns": [ 33 { 34 "data": 'ip', 35 "render": function(data, type, row, meta) { 36 return '<a href="[% device_ports | none %]&q=' + encodeURIComponent(data) + '&f=' + encodeURIComponent(row.port.port) + '&c_nodes=on&n_ssid=on">' + he.encode(row.device.dns || row.device.name || row.ip) + '(' + he.encode(row.port.port) + ')</a>'; 37 } 38 }, { 39 "data": 'broadcast', 40 "render": function(data, type, row, meta) { 41 return (data ? 'Yes' : 'No'); 42 } 43 }, { 44 "data": 'device.model', 45 "render": function(data, type, row, meta) { 46 return he.encode(data || ''); 47 } 48 }, { 49 "data": 'ssid', 50 "searchable": false, 51 "orderable": false, 52 "render": function(data, type, row, meta) { 53 return he.encode(data || ''); 54 } 55 }, { 56 "data": 'device.vendor', 57 "render": function(data, type, row, meta) { 58 return he.encode(data || ''); 59 } 60 } 61 ], 62 [% ELSE %] 63 "columns": [ 64 { 65 "data": 'ssid', 66 "render": function(data, type, row, meta) { 67 return '<a href="[% uri_for('/report/portssid') | none %]?ssid=' + encodeURIComponent(data) + '">' + he.encode(data || '') + '</a>'; 68 } 69 }, { 70 "data": 'broadcast', 71 "render": function(data, type, row, meta) { 72 return (data ? 'Yes' : 'No'); 73 } 74 }, { 75 "data": 'count', 76 "searchable": false, 77 "render": function(data, type, row, meta) { 78 return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); 79 } 80 }, 81 ], 82 "order": [[ 2, "desc" ]], 83 [% END %] 84[% INCLUDE 'ajax/datatabledefaults.tt' -%] 85 }); 86}); 87</script> 88