Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with "Search with a Query Task" select element #218

Open
banuelosj opened this issue Feb 14, 2018 · 3 comments
Open

Issue with "Search with a Query Task" select element #218

banuelosj opened this issue Feb 14, 2018 · 3 comments

Comments

@banuelosj
Copy link
Contributor

The select element does not change the query when the user selects a different TYPE. It stays at the default 'MAX' query. The console outputs an error message "Cannot read property 'on' of null. I printed to the console the dom.byId("queryDiv"), and it printed null. I attached a screenshot of the error message.
console_error_query_task

@jgravois
Copy link
Contributor

interesting. the chrome only error can be resolved by wiring up the event listener before the API is used to place the dropdown on the page.

// Select a sql query
on(dom.byId("queryDiv"), "change", function(e) {
  var sql = e.target.value;
  getFeatures(sql);
})

// Add select element to UI
view.ui.add(dom.byId("queryDiv"), {
  position: "top-right"
});

@banuelosj if you can you test this change on your side it'd be super helpful. bonus points if you can submit a PR afterward.

@banuelosj
Copy link
Contributor Author

Yes it worked! I worked on it on my own and used a Promise to fix the error (I also switched the event listener so I guess the promise was not needed after all). Just switching the event listener before is a lot easier to understand than adding the Promise.

@banuelosj
Copy link
Contributor Author

I will work on the PR right now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants