<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
  <thead>
    <tr>
      <th class="nd_center-cell">Location</th>
      <th class="nd_center-cell">Device</th>
      <th class="nd_center-cell">System Name</th>
      <th class="nd_center-cell">Vendor</th>
      <th class="nd_center-cell">Model</th>
    </tr>
  </thead>
</table>

<script type="text/javascript">
$(document).ready(function() {
    var table = $('#data-table').dataTable({
        "deferRender": true,
        "order": [[ 0, "asc" ], [2, "asc"], [ 3, "asc" ], [4, "asc"]],
        "data": [% results | none %],
        "columns": [
           {
                "data": 'location',
                "render": function(data, type, row, meta) {
                  if (data) {
                    return '<a href="[% search_device | none %]&q=' + encodeURIComponent(data) + '&location=' + encodeURIComponent(data) + '">' + he.encode(data) + '</a>';

                  } else {
                    return '[Not Set]';
                  }
                }
            }, {
                "data": 'ip',
                "render": function(data, type, row, meta) {
                    return '<a href="[% uri_for('/device') | none %]?q=' + encodeURIComponent(data) + '">' + he.encode(row.dns || row.ip) + '</a>';
                }
            }, {
                "data": 'name',
                "render": function(data, type, row, meta) {
                    return '<a href="[% search_device | none %]&q=' + encodeURIComponent(data) + '&model=' + encodeURIComponent(data) + '">' + he.encode(data || '') + '</a>';
                }
            }, {
                "data": 'vendor',
                "render": function(data, type, row, meta) {
                    return '<a href="[% search_device | none %]&q=' + encodeURIComponent(data) + '&model=' + encodeURIComponent(data) + '">' + he.encode(data || '') + '</a>';
                }
            }, {
                "data": 'model',
                "render": function(data, type, row, meta) {
                    return '<a href="[% search_device | none %]&q=' + encodeURIComponent(data) + '&model=' + encodeURIComponent(data) + '">' + he.encode(data || '') + '</a>';
                }
            }
        ],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
    });

});
</script>
