Skip to content

Commit 9b08524

Browse files
committed
Show the local I2C sensors in the right position in the list not at
the end.
1 parent 2249df0 commit 9b08524

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

www/app/HardwareController.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4881,22 +4881,25 @@ define(['app'], function (app) {
48814881
dataType: 'json',
48824882
success: function(data) {
48834883
if (typeof data.result != 'undefined') {
4884+
var i2cidx = 0, idx = 0;
48844885
$.each(data.result, function(i,item) {
48854886
$.myglobals.HardwareTypesStr[item.idx] = item.name;
48864887
// Don't show I2C sensors
48874888
if (item.name.indexOf("Local I2C sensor") != -1) {
48884889
$.myglobals.HardwareI2CStr[item.idx] = item.name;
4890+
i2cidx = idx;
48894891
return true;
48904892
}
48914893
// Show other sensors
48924894
var option = $('<option />');
48934895
option.attr('value', item.idx).text(item.name);
48944896
$("#hardwareparamstable #combotype").append(option);
4897+
idx++;
48954898
});
48964899
// regroup local I2C sensors under index 1000
48974900
var option = $('<option />');
48984901
option.attr('value', 1000).text("Local I2C sensors");
4899-
$("#hardwareparamstable #combotype").append(option);
4902+
option.insertAfter('#hardwareparamstable #combotype :nth-child(' + i2cidx + ')')
49004903
}
49014904
}
49024905
});

0 commit comments

Comments
 (0)