<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
  <thead>
    <tr>
      <th>Device</th>
      <th>Port</th>
      <th>Remote ID</th>
      <th>Remote IP</th>
      <th>Remote Port</th>
      <th>Remote Type</th>
    </tr>
  </thead>
</table>

<script type="text/javascript">
$(document).ready(function() {
  var table = $('#data-table').dataTable({
    "deferRender": true,
    "data": [% results | none %],
    "columns": [
      {
        "data": 'ip',
        "render": function(data, type, row, meta) {
          return he.encode(row.dns || row.name || data);
        }
      }, {
        "data": 'port',
        "type": 'portsort',
        "render": function(data, type, row, meta) {
          return type === 'display' ?
            '<a href="[% device_ports | none %]&c_nodes=on&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '">' + he.encode(data || '') + '</a>' :
            he.encode(data || '');
        }
      }, {
        "data": 'remote_id',
        "render": function(data, type, row, meta) {
          return he.encode(data || '');
        }
      }, {
        "data": 'remote_ip',
        "render": function(data, type, row, meta) {
          return '<a href="[% search_node | none %]&q=' + encodeURIComponent(data || '') + '">' + he.encode(data || '') + '</a>';
        }
      }, {
        "data": 'remote_port',
        "render": function(data, type, row, meta) {
          return he.encode(data || '');
        }
      }, {
        "data": 'remote_type',
        "render": function(data, type, row, meta) {
          return he.encode(data || '');
        }
      }
    ],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
  });
});
</script>
