Skip to content

Commit 36174a8

Browse files
authored
Merge pull request #1608 from netalertx/next_release
PLG: Enhance IP sorting in device table for correct numeric order #1606
2 parents 686a1c8 + 309315d commit 36174a8

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

front/js/network-api.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,15 @@ function loadDeviceTable({ sql, containerSelector, tableId, wrapperHtml = null,
156156
{
157157
title: getString('Network_Table_IP'),
158158
data: 'devLastIP',
159-
width: '5%'
159+
width: '5%',
160+
render: function (ip, type) {
161+
if (type === 'sort') {
162+
// Convert each octet to a zero-padded 3-digit string for correct numeric sort
163+
if (!ip) return '';
164+
return ip.split('.').map(o => o.padStart(3, '0')).join('.');
165+
}
166+
return ip || '';
167+
}
160168
},
161169
{
162170
title: getString('Device_TableHead_Port'),

0 commit comments

Comments
 (0)