Skip to content

Commit

Permalink
use-select2
Browse files Browse the repository at this point in the history
  • Loading branch information
haslinghuis committed Jun 5, 2023
1 parent 84a0d6b commit 45dac7c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/css/tabs/onboard_logging.less
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@
line-height: 20px;
}
}
.blackboxDebugModeText {
margin-left: 7px !important;
}
.sdcard {
padding: 10px;
float: left;
Expand Down
17 changes: 16 additions & 1 deletion src/js/tabs/onboard_logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,22 @@ onboard_logging.initialize = function (callback) {
}

debugModeSelect.val(FC.PID_ADVANCED_CONFIG.debugMode);
debugModeSelect.sortSelect("NONE");

// Convert to select2 and order alphabetic
debugModeSelect.select2({
sorter(data) {
return data.sort(function(a, b) {
if (a.text === "NONE" || b.text === i18n.getMessage('onboardLoggingDebugModeUnknown')) {
return -1;
} else if (b.text ==="NONE" || a.text === i18n.getMessage('onboardLoggingDebugModeUnknown')) {
return 1;
} else {
return a.text.localeCompare(b.text);
}
});
},
});
// debugModeSelect.sortSelect("NONE");

} else {
$('.blackboxDebugMode').hide();
Expand Down

0 comments on commit 45dac7c

Please sign in to comment.