1<table id="ps-data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
2  <thead>
3    <tr>
4      <th>Status</th>
5      <th>Name</th>
6      <th>Port</th>
7      <th>VLAN</th>
8      <th>Speed</th>
9      <th>Last Change</th>
10    </tr>
11  </thead>
12</table>
13
14<script type="text/javascript">
15$(document).ready(function() {
16  var table = $('#ps-data-table').dataTable({
17    "deferRender": true,
18    "data": [% results | none %],
19    "columnDefs": [
20        { "sortable": false, "targets": 0 },
21        { "searchable": false, "targets": 0 },
22        { "type": 'portsort', "targets": [ 'portsort' ] }
23    ],
24    "order": [[ 1, 'asc' ]],
25    "columns": [{
26        "data": 'up',
27        "className": "nd_center-cell nd_devport-icon",
28        "render": function(data, type, row, meta) {
29          if (row.up_admin != "up") {
30            return'<i class="icon-remove"></i>';
31          }
32          else if (row.up_admin == "up" && (row.up != "up" && row.up != "dormant")) {
33            return '<i class="icon-arrow-down text-error"></i>';
34          }
35          else {
36            return '<i class="icon-angle-up text-success"></i>';
37          }
38        }
39      }, {
40        "data": 'name',
41        "render": function(data, type, row, meta) {
42          return he.encode(data || '');
43        }
44      }, {
45        "data": 'ip',
46        "className": "nd_nowrap nd_center-cell",
47        "render": function(data, type, row, meta) {
48          var ddns = '';
49          if (row.device.dns || row.device.name) {
50            ddns = '<br>(' + he.encode(row.device.dns || row.device.name)  + ')';
51          }
52          return '<a href="[% device_ports | none %]&q=' + encodeURIComponent(data)
53            + '&f=' + encodeURIComponent(row.port) + '">' + he.encode(data)
54            + ' [' + he.encode(row.port) + ']</a>' + ddns;
55        }
56      }, {
57        "data": 'port_vlans.vlan',
58        "render": function(data, type, row, meta) {
59          return data || '';
60        }
61      }, {
62        "data": 'speed',
63        "render": function(data, type, row, meta) {
64          return data || '';
65        }
66      }, {
67        "data": 'lastchange_stamp',
68        "render": function(data, type, row, meta) {
69          return data || '';
70        }
71      }
72    ],
73[% INCLUDE 'ajax/datatabledefaults.tt' -%]
74  });
75});</script>
76
77