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()));
|
drawline(grabPositionByName($('#pointa option:selected').text()),grabPositionByName($('#pointb option:selected').text()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
$('#cbs').click(function() {populateFBSelect(); });
|
||||||
|
$('#cbp').click(function() {populateFBSelect(); });
|
||||||
$("#pointa").focus(function() {
|
$("#pointa").focus(function() {
|
||||||
lastInputBox = "pointa";
|
lastInputBox = "pointa";
|
||||||
// console.log('Updating last touched box to : ' + lastInputBox)
|
// console.log('Updating last touched box to : ' + lastInputBox)
|
||||||
@ -44,26 +45,8 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
|
|
||||||
function populateUserFields() {
|
function populateUserFields() {
|
||||||
//Populate find by select dropdown
|
// Populate findby box
|
||||||
var types = [];
|
populateFBSelect();
|
||||||
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 pointa and pointb dropdowns
|
// Populate pointa and pointb dropdowns
|
||||||
var types = ['planets','stations'];
|
var types = ['planets','stations'];
|
||||||
option = "";
|
option = "";
|
||||||
@ -81,6 +64,28 @@ function populateUserFields() {
|
|||||||
$('#pointa').html(option);
|
$('#pointa').html(option);
|
||||||
$('#pointb').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) {
|
function openTab(evt,tabName) {
|
||||||
|
@ -123,7 +123,7 @@
|
|||||||
<select id="findbyselect">
|
<select id="findbyselect">
|
||||||
<option value=''></option>
|
<option value=''></option>
|
||||||
</select> <br />
|
</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>
|
<button id="submitfindbyname" class="btn">Find</button>
|
||||||
</span>
|
</span>
|
||||||
<span class="toolsep"></span>
|
<span class="toolsep"></span>
|
||||||
|
Loading…
Reference in New Issue
Block a user