File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -4881,22 +4881,25 @@ define(['app'], function (app) {
4881
4881
dataType : 'json' ,
4882
4882
success : function ( data ) {
4883
4883
if ( typeof data . result != 'undefined' ) {
4884
+ var i2cidx = 0 , idx = 0 ;
4884
4885
$ . each ( data . result , function ( i , item ) {
4885
4886
$ . myglobals . HardwareTypesStr [ item . idx ] = item . name ;
4886
4887
// Don't show I2C sensors
4887
4888
if ( item . name . indexOf ( "Local I2C sensor" ) != - 1 ) {
4888
4889
$ . myglobals . HardwareI2CStr [ item . idx ] = item . name ;
4890
+ i2cidx = idx ;
4889
4891
return true ;
4890
4892
}
4891
4893
// Show other sensors
4892
4894
var option = $ ( '<option />' ) ;
4893
4895
option . attr ( 'value' , item . idx ) . text ( item . name ) ;
4894
4896
$ ( "#hardwareparamstable #combotype" ) . append ( option ) ;
4897
+ idx ++ ;
4895
4898
} ) ;
4896
4899
// regroup local I2C sensors under index 1000
4897
4900
var option = $ ( '<option />' ) ;
4898
4901
option . attr ( 'value' , 1000 ) . text ( "Local I2C sensors" ) ;
4899
- $ ( " #hardwareparamstable #combotype" ) . append ( option ) ;
4902
+ option . insertAfter ( ' #hardwareparamstable #combotype :nth-child(' + i2cidx + ')' )
4900
4903
}
4901
4904
}
4902
4905
} ) ;
You can’t perform that action at this time.
0 commit comments