1<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
2  <thead>
3    <tr>
4      <th class="nd_center-cell">Location</th>
5      <th class="nd_center-cell">Device</th>
6      <th class="nd_center-cell">System Name</th>
7      <th class="nd_center-cell">Vendor</th>
8      <th class="nd_center-cell">Model</th>
9    </tr>
10  </thead>
11</table>
12
13<script type="text/javascript">
14$(document).ready(function() {
15    var table = $('#data-table').dataTable({
16        "deferRender": true,
17        "order": [[ 0, "asc" ], [2, "asc"], [ 3, "asc" ], [4, "asc"]],
18        "data": [% results | none %],
19        "columns": [
20           {
21                "data": 'location',
22                "render": function(data, type, row, meta) {
23                  if (data) {
24                    return '<a href="[% search_device | none %]&q=' + encodeURIComponent(data) + '&location=' + encodeURIComponent(data) + '">' + he.encode(data) + '</a>';
25
26                  } else {
27                    return '[Not Set]';
28                  }
29                }
30            }, {
31                "data": 'ip',
32                "render": function(data, type, row, meta) {
33                    return '<a href="[% uri_for('/device') | none %]?q=' + encodeURIComponent(data) + '">' + he.encode(row.dns || row.ip) + '</a>';
34                }
35            }, {
36                "data": 'name',
37                "render": function(data, type, row, meta) {
38                    return '<a href="[% search_device | none %]&q=' + encodeURIComponent(data) + '&model=' + encodeURIComponent(data) + '">' + he.encode(data || '') + '</a>';
39                }
40            }, {
41                "data": 'vendor',
42                "render": function(data, type, row, meta) {
43                    return '<a href="[% search_device | none %]&q=' + encodeURIComponent(data) + '&model=' + encodeURIComponent(data) + '">' + he.encode(data || '') + '</a>';
44                }
45            }, {
46                "data": 'model',
47                "render": function(data, type, row, meta) {
48                    return '<a href="[% search_device | none %]&q=' + encodeURIComponent(data) + '&model=' + encodeURIComponent(data) + '">' + he.encode(data || '') + '</a>';
49                }
50            }
51        ],
52[% INCLUDE 'ajax/datatabledefaults.tt' -%]
53    });
54
55});
56</script>
57