Don't regenerate all fields if we just need the one - find by select
This commit is contained in:
parent
e9b0b7b55a
commit
2bc5c8b990
@ -26,7 +26,8 @@ $(document).ready(function() {
|
||||
drawline(grabPositionByName($('#pointa option:selected').text()),grabPositionByName($('#pointb option:selected').text()));
|
||||
}
|
||||
});
|
||||
|
||||
$('#cbs').click(function() {populateFBSelect(); });
|
||||
$('#cbp').click(function() {populateFBSelect(); });
|
||||
$("#pointa").focus(function() {
|
||||
lastInputBox = "pointa";
|
||||
// console.log('Updating last touched box to : ' + lastInputBox)
|
||||
@ -44,26 +45,8 @@ $(document).ready(function() {
|
||||
|
||||
|
||||
function populateUserFields() {
|
||||
//Populate find by select dropdown
|
||||
var types = [];
|
||||
var checkboxes = document.getElementsByName("objtype");
|
||||
for (var type in checkboxes) {
|
||||
if(checkboxes[type].checked) {
|
||||
types[type] = checkboxes[type].value;
|
||||
}
|
||||
|
||||
}
|
||||
var option = '';
|
||||
for (var type in types) {
|
||||
var keys = Object.keys(listobjects(types[type]));
|
||||
keys.sort().forEach(function(element, index, array){
|
||||
option += '<option value="'+ escapeHTML(element) + '">' + escapeHTML(element) + '</option>';
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$('#findbyselect').html(option);
|
||||
|
||||
// Populate findby box
|
||||
populateFBSelect();
|
||||
// Populate pointa and pointb dropdowns
|
||||
var types = ['planets','stations'];
|
||||
option = "";
|
||||
@ -81,6 +64,28 @@ function populateUserFields() {
|
||||
$('#pointa').html(option);
|
||||
$('#pointb').html(option);
|
||||
|
||||
}
|
||||
function populateFBSelect() {
|
||||
//Populate find by select dropdown
|
||||
var types = [];
|
||||
var checkboxes = document.getElementsByName("objtype");
|
||||
for (var type in checkboxes) {
|
||||
if(checkboxes[type].checked) {
|
||||
types[type] = checkboxes[type].value;
|
||||
}
|
||||
|
||||
}
|
||||
var option = '';
|
||||
for (var type in types) {
|
||||
var keys = Object.keys(listobjects(types[type]));
|
||||
keys.sort().forEach(function(element, index, array){
|
||||
option += '<option value="'+ escapeHTML(element) + '">' + escapeHTML(element) + '</option>';
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$('#findbyselect').html(option);
|
||||
|
||||
}
|
||||
|
||||
function openTab(evt,tabName) {
|
||||
|
@ -123,7 +123,7 @@
|
||||
<select id="findbyselect">
|
||||
<option value=''></option>
|
||||
</select> <br />
|
||||
<input type="checkbox" name="objtype" id="cbp" value="planets" checked><label for="cbp"> Planets</label> <input type="checkbox" name="objtype" id="cbs" value="stations" onclick="populateUserFields();"> <label for="cbs">Stations</label>
|
||||
<input type="checkbox" name="objtype" id="cbp" value="planets" checked><label for="cbp"> Planets</label> <input type="checkbox" name="objtype" id="cbs" value="stations" > <label for="cbs">Stations</label>
|
||||
<button id="submitfindbyname" class="btn">Find</button>
|
||||
</span>
|
||||
<span class="toolsep"></span>
|
||||
|
Loading…
Reference in New Issue
Block a user