Skip to content

Commit 88b7c9a

Browse files
authored
Merge pull request #2575 from Asizon/convert_serial_protocols_select2
Convert serial rx and Spi rx protocols selectors to Select2
2 parents dc5d1d9 + 675e038 commit 88b7c9a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/js/tabs/receiver.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,17 @@ TABS.receiver.initialize = function (callback) {
259259
// select current serial RX type
260260
serialRxSelectElement.val(FC.RX_CONFIG.serialrx_provider);
261261

262+
// Convert to select2 and order alphabetic
263+
if (!GUI.isCordova()) {
264+
serialRxSelectElement.select2({
265+
sorter(data) {
266+
return data.sort(function(a, b) {
267+
return a.text.localeCompare(b.text);
268+
});
269+
},
270+
});
271+
}
272+
262273
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_31)) {
263274
const spiRxTypes = [
264275
'NRF24_V202_250K',
@@ -322,6 +333,17 @@ TABS.receiver.initialize = function (callback) {
322333

323334
// select current serial RX type
324335
spiRxElement.val(FC.RX_CONFIG.rxSpiProtocol);
336+
337+
if (!GUI.isCordova()) {
338+
// Convert to select2 and order alphabetic
339+
spiRxElement.select2({
340+
sorter(data) {
341+
return data.sort(function(a, b) {
342+
return a.text.localeCompare(b.text);
343+
});
344+
},
345+
});
346+
}
325347
}
326348

327349

0 commit comments

Comments
 (0)