Use custom portsort plug-in on port columns within DataTables not using server-side processing
This commit is contained in:
		| @@ -34,8 +34,11 @@ $(document).ready(function() { | ||||
|         } | ||||
|       }, { | ||||
|         "data": 'port', | ||||
|         "type": 'portsort', | ||||
|         "render": function(data, type, row, meta) { | ||||
|           return '<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '">' + he.encode(data || '') + '</a>'; | ||||
|           return type === 'display' ? | ||||
|             '<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '">' + he.encode(data || '') + '</a>' : | ||||
|             data; | ||||
|         } | ||||
|       }, { | ||||
|         "data": 'name', | ||||
|   | ||||
| @@ -62,8 +62,11 @@ $(document).ready(function() { | ||||
|         "visible": false | ||||
|       }, { | ||||
|         "data": 'port', | ||||
|         "type": 'portsort', | ||||
|         "render": function(data, type, row, meta) { | ||||
|           return '<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '">' + he.encode(data) + '</a>'; | ||||
|           return type === 'display' ? | ||||
|             '<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '">' + he.encode(data) + '</a>' : | ||||
|             data; | ||||
|         } | ||||
|       }, { | ||||
|         "data": 'port_name', | ||||
|   | ||||
| @@ -30,8 +30,11 @@ $(document).ready(function() { | ||||
|         } | ||||
|       }, { | ||||
|         "data": 'left_port', | ||||
|         "type": 'portsort', | ||||
|         "render": function(data, type, row, meta) { | ||||
|           return '<a href="[% device_ports %]&q=' + encodeURIComponent(row.left_dns || row.left_ip) + '&f=' + encodeURIComponent(data) + '&c_duplex=on">' + he.encode(data) + '</a>'; | ||||
|           return type === 'display' ? | ||||
|             '<a href="[% device_ports %]&q=' + encodeURIComponent(row.left_dns || row.left_ip) + '&f=' + encodeURIComponent(data) + '&c_duplex=on">' + he.encode(data) + '</a>' : | ||||
|             data; | ||||
|         } | ||||
|       }, { | ||||
|         "data": 'left_duplex', | ||||
| @@ -45,8 +48,11 @@ $(document).ready(function() { | ||||
|         } | ||||
|       }, { | ||||
|         "data": 'right_port', | ||||
|         "type": 'portsort', | ||||
|         "render": function(data, type, row, meta) { | ||||
|           return '<a href="[% device_ports %]&q=' + encodeURIComponent(row.right_dns || row.right_ip) + '&f=' + encodeURIComponent(data) + '&c_duplex=on">' + he.encode(data) + '</a>'; | ||||
|           return type === 'display' ? | ||||
|             '<a href="[% device_ports %]&q=' + encodeURIComponent(row.right_dns || row.right_ip) + '&f=' + encodeURIComponent(data) + '&c_duplex=on">' + he.encode(data) + '</a>' : | ||||
|             data; | ||||
|         } | ||||
|       }, { | ||||
|         "data": 'right_duplex', | ||||
|   | ||||
| @@ -28,8 +28,11 @@ $(document).ready(function() { | ||||
|         } | ||||
|       }, { | ||||
|         "data": 'port', | ||||
|         "type": 'portsort', | ||||
|         "render": function(data, type, row, meta) { | ||||
|           return '<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '&c_duplex=on">' + he.encode(data) + '</a>'; | ||||
|           return type === 'display' ? | ||||
|             '<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '&c_duplex=on">' + he.encode(data) + '</a>' : | ||||
|             data; | ||||
|         } | ||||
|       }, { | ||||
|         "data": 'name', | ||||
|   | ||||
| @@ -30,8 +30,11 @@ $(document).ready(function() { | ||||
|         } | ||||
|       }, { | ||||
|         "data": 'port', | ||||
|         "type": 'portsort', | ||||
|         "render": function(data, type, row, meta) { | ||||
|           return '<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '">' + he.encode(data) + '</a>'; | ||||
|           return type === 'display' ? | ||||
|             '<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '">' + he.encode(data) + '</a>' : | ||||
|             data; | ||||
|         } | ||||
|       }, { | ||||
|         "data": 'remote_id', | ||||
|   | ||||
| @@ -28,8 +28,11 @@ $(document).ready(function() { | ||||
|         } | ||||
|       }, { | ||||
|         "data": 'port', | ||||
|         "type": 'portsort', | ||||
|         "render": function(data, type, row, meta) { | ||||
|           return '<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '&c_nodes=on">' + he.encode(data) + '</a>'; | ||||
|           return type === 'display' ? | ||||
|             '<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '&c_nodes=on">' + he.encode(data) + '</a>' : | ||||
|             data; | ||||
|         } | ||||
|       }, { | ||||
|         "data": 'description', | ||||
|   | ||||
| @@ -29,8 +29,11 @@ $(document).ready(function() { | ||||
|         } | ||||
|       }, { | ||||
|         "data": 'port', | ||||
|         "type": 'portsort', | ||||
|         "render": function(data, type, row, meta) { | ||||
|           return '<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '&c_nodes=on">' + he.encode(data) + '</a>'; | ||||
|           return type === 'display' ? | ||||
|             '<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '&c_nodes=on">' + he.encode(data) + '</a>' : | ||||
|             data; | ||||
|         } | ||||
|       }, { | ||||
|         "data": 'description', | ||||
|   | ||||
| @@ -29,8 +29,11 @@ $(document).ready(function() { | ||||
|         } | ||||
|       }, { | ||||
|         "data": 'port', | ||||
|         "type": 'portsort', | ||||
|         "render": function(data, type, row, meta) { | ||||
|           return '<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '&c_nodes=on">' + he.encode(data) + '</a>'; | ||||
|           return type === 'display' ? | ||||
|             '<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '&c_nodes=on">' + he.encode(data) + '</a>' : | ||||
|             data; | ||||
|         } | ||||
|       }, { | ||||
|         "data": 'description', | ||||
|   | ||||
		Reference in New Issue
	
	Block a user