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>Description</th>
7      <th>Duplex</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    "data": [% results | none %],
17    "columns": [
18      {
19        "data": 'ip',
20        "render": function(data, type, row, meta) {
21          return he.encode(row.device.dns || row.device.name || row.ip);
22        }
23      }, {
24        "data": 'port',
25        "type": 'portsort',
26        "render": function(data, type, row, meta) {
27          return type === 'display' ?
28            '<a href="[% device_ports | none %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '&c_duplex=on">' + he.encode(data || '') + '</a>' :
29            he.encode(data || '');
30        }
31      }, {
32        "data": 'name',
33        "render": function(data, type, row, meta) {
34          return he.encode(data || '');
35        }
36      }, {
37        "data": 'duplex',
38        "searchable": false,
39        "orderable": false,
40        "render": function(data, type, row, meta) {
41          return he.encode(capitalizeFirstLetter(data));
42        }
43      }
44    ],
45[% INCLUDE 'ajax/datatabledefaults.tt' -%]
46  });
47});
48</script>
49