1<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0"> 2 <thead> 3 <tr> 4 <th>Device</th> 5 <th>Model</th> 6 <th>Location</th> 7 <th>Port</th> 8 <th>SSID</th> 9 <th>Node Count</th> 10 </tr> 11 </thead> 12</table> 13 14<script type="text/javascript"> 15$(document).ready(function() { 16 var table = $('#data-table').dataTable({ 17 "deferRender": true, 18 "order": [[ 5, "desc" ]], 19 "data": [% results | none %], 20 "columns": [ 21 { 22 "data": 'ip', 23 "render": function(data, type, row, meta) { 24 return type === 'display' ? 25 '<a href="[% uri_for('/device') | none %]?tab=details&q=' + encodeURIComponent(row.ip) + '">' 26 + he.encode(row.dns || row.name || row.ip) + '</a>' : 27 data; 28 } 29 }, { 30 "data": 'model', 31 "render": function(data, type, row, meta) { 32 return he.encode(data || ''); 33 } 34 }, { 35 "data": 'location', 36 "render": function(data, type, row, meta) { 37 return he.encode(data || ''); 38 } 39 }, { 40 "data": 'port', 41 "type": 'portsort', 42 "render": function(data, type, row, meta) { 43 return type === 'display' ? 44 '<a href="[% device_ports | none %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '&c_nodes=on">' + he.encode(data || '') + '</a>' : 45 he.encode(data || ''); 46 } 47 }, { 48 "data": 'ssid', 49 "render": function(data, type, row, meta) { 50 return he.encode(data || ''); 51 } 52 }, { 53 "data": 'mac_count', 54 "searchable": false, 55 "render": function(data, type, row, meta) { 56 return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); 57 } 58 } 59 ], 60[% INCLUDE 'ajax/datatabledefaults.tt' -%] 61 }); 62}); 63</script> 64