1<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0"> 2 <thead> 3 <tr> 4 <th>Left Device</th> 5 <th>Port</th> 6 <th>Duplex</th> 7 <th>Right Device</th> 8 <th>Port</th> 9 <th>Duplex</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 "data": [% results | none %], 19 "columns": [ 20 { 21 "data": 'left_ip', 22 "render": function(data, type, row, meta) { 23 return he.encode(row.left_dns || row.left_ip); 24 } 25 }, { 26 "data": 'left_port', 27 "type": 'portsort', 28 "render": function(data, type, row, meta) { 29 return type === 'display' ? 30 '<a href="[% device_ports | none %]&q=' + encodeURIComponent(row.left_dns || row.left_ip) + '&f=' + encodeURIComponent(data) + '&c_duplex=on">' + he.encode(data || '') + '</a>' : 31 he.encode(data || ''); 32 } 33 }, { 34 "data": 'left_duplex', 35 "render": function(data, type, row, meta) { 36 return he.encode(capitalizeFirstLetter(data || '')); 37 } 38 }, { 39 "data": 'right_ip', 40 "render": function(data, type, row, meta) { 41 return he.encode(row.right_dns || row.right_ip); 42 } 43 }, { 44 "data": 'right_port', 45 "type": 'portsort', 46 "render": function(data, type, row, meta) { 47 return type === 'display' ? 48 '<a href="[% device_ports | none %]&q=' + encodeURIComponent(row.right_dns || row.right_ip) + '&f=' + encodeURIComponent(data) + '&c_duplex=on">' + he.encode(data || '') + '</a>' : 49 he.encode(data || ''); 50 } 51 }, { 52 "data": 'right_duplex', 53 "render": function(data, type, row, meta) { 54 return he.encode(capitalizeFirstLetter(data || '')); 55 } 56 } 57 ], 58[% INCLUDE 'ajax/datatabledefaults.tt' -%] 59 }); 60}); 61</script> 62