Skip to content

Commit 309315d

Browse files
committed
PLG: Enhance IP sorting in device table for correct numeric order #1606
1 parent 51b8cf0 commit 309315d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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)