1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-13 19:40:22 +03:00
This commit is contained in:
Pawel Spychalski (DzikuVx) 2016-12-23 23:57:05 +01:00
parent 725e062479
commit 1b4c729e46
6 changed files with 72 additions and 328 deletions

View file

@ -355,5 +355,26 @@ GUI_control.prototype.updateProfileChange = function() {
$('#profilechange').val(CONFIG.profile);
};
GUI_control.prototype.fillSelect = function ($element, values, currentValue, unit) {
if (unit == null) {
unit = '';
}
$element.find("*").remove();
for (var i in values) {
if (values.hasOwnProperty(i)) {
$element.append('<option value="' + i + '">' + values[i] + '</option>');
}
}
/*
* If current Value is not on the list, add a new entry
*/
if (currentValue != null && $element.find('[value="' + currentValue + '"]').length == 0) {
$element.append('<option value="' + currentValue + '">' + currentValue + unit + '</option>');
}
};
// initialize object into GUI variable
var GUI = new GUI_control();