<table id="vs-data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
  <thead>
    <tr>
      <th>VLAN</th>
      <th>Device</th>
      <th>Description</th>
      <th>Ports</th>
      <th>Model</th>
      <th>OS</th>
      <th>Vendor</th>
    </tr>
  </thead>
</table>

<script type="text/javascript">
$(document).ready(function() {
  var table = $('#vs-data-table').dataTable({
    "deferRender": true,
    "data": [% results | none %],
    "columns": [{
        "data": 'vlans.vlan',
        "render": function(data, type, row, meta) {
          return '<a class="nd_linkcell nd_stealth-link" href="[% device_ports | none %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '">' + data + '</a>';
        }
      }, {
        "data": 'ip',
        "render": function(data, type, row, meta) {
          return '<a href="[% device_ports | none %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(row.vlans.vlan) + '">' + he.encode(row.dns || row.ip) + '</a>';
        }
      }, {
        "data": 'vlans.description',
        "render": function(data, type, row, meta) {
          return '<a class="nd_linkcell nd_stealth-link" href="[% device_ports | none %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(row.vlans.vlan) + '">' + he.encode(data || '') + '</a>';
        }
      }, {
        "data": 'pcount',
        "searchable": false,
        "render": function(data, type, row, meta) {
          return '<a class="nd_linkcell nd_stealth-link" href="[% device_ports | none %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(row.vlans.vlan) + '">' + he.encode(data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")) + '</a>';
        }
      }, {
        "data": 'model',
        "render": function(data, type, row, meta) {
          return '<a class="nd_linkcell nd_stealth-link" href="[% device_ports | none %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(row.vlans.vlan) + '">' + he.encode(data || '') + '</a>';
        }
      }, {
        "data": 'os',
        "render": function(data, type, row, meta) {
          return '<a class="nd_linkcell nd_stealth-link" href="[% device_ports | none %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(row.vlans.vlan) + '">' + he.encode(data || '') + '</a>';
        }
      }, {
        "data": 'vendor',
        "render": function(data, type, row, meta) {
          return '<a class="nd_linkcell nd_stealth-link" href="[% device_ports | none %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(row.vlans.vlan) + '">' + he.encode(data || '') + '</a>';
        }
      }
    ],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
  });
});</script>
