Geographic Information Systems Asked on June 14, 2021
Below I have shared the link.
The issue – ui.Select remebers previous selections – even after being reset.
Consequentially, if the user picks the same value twice – onChange is not activated.
I am working in code editor with JavaScript
https://code.earthengine.google.com/4341dde5f526ef48f2eae20be42eb2b0
ui.Select
does not change its value when a placeholder text is changed. Therefore, within Reset
button while resetting the items (according to me unnecessary) and changing the placeholder text to "Choose a location2..." of the select
button, you are not changing the value of select, but merely changing the text that is displayed on the select
button. This is why a change is not registered when you click on the same location again. You can verify this by printing select.getValue()
after you click on Reset.
I think you want to set the location value to default (0,0) when you click on reset. Then, if you again click on the original location, a change will be registered. To achieve that, you can change your reset function as follows:
var Reset=ui.Button({
label: "Reset Dropdown",
onClick: function () {
select.setValue("Choose a location...")
// select.items().reset();
// select.items().reset(Object.keys(places));
// select.setPlaceholder('Choose a location2...');
}
});
And explicitly set the default location within the select
button.
Link to complete code.
Answered by kkrao on June 14, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP