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>Port</th> 6 <th>Port Description</th> 7 <th>STP Status</th> 8 </tr> 9 </thead> 10</table> 11 12<script type="text/javascript"> 13$(document).ready(function() { 14 var table = $('#data-table').dataTable({ 15 "deferRender": true, 16 "order": [[ 0, "asc" ], [1, "asc"]], 17 "data": [% results | none %], 18 "columns": [ 19 { 20 "data": 'ip', 21 "render": function(data, type, row, meta) { 22 return he.encode(row.dns || row.name || row.ip); 23 } 24 }, { 25 "data": 'port', 26 "type": 'portsort', 27 "render": function(data, type, row, meta) { 28 return type === 'display' ? 29 '<a href="[% device_ports | none %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '&c_nodes=on">' + he.encode(data || '') + '</a>' : 30 he.encode(data || ''); 31 } 32 }, { 33 "data": 'description', 34 "render": function(data, type, row, meta) { 35 return he.encode(data || ''); 36 } 37 }, { 38 "data": 'stp', 39 "orderable": false, 40 "searchable": false, 41 "render": function(data, type, row, meta) { 42 return he.encode(data || ''); 43 } 44 } 45 ], 46[% INCLUDE 'ajax/datatabledefaults.tt' -%] 47 }); 48}); 49</script> 50 51