Hi,
I am using the San Francisco street trees by year | ArcGIS API for JavaScript example with a modified query (the dataset is too big to use the method in the example) with AMD and it is returning an error when a combo box item is selected:
Unhandled exception at line 18, column 1 in Function code
0x800a1391 - JavaScript runtime error: 'selectTree' is undefined
The combo box is populating using a QueryTask that returns distinct values into dojo.data.ItemFileReadStore. My guess is that I am missing some sort of dojo.connect function (or whatever AMD uses now) or the function is in the wrong place. Hopefully I have missed something really basic and you JS gurus can help.
Here is my function:
function selectTree(item) {
//apply a definition expression to the layer to only display data of the selected species
var query = "scientificName='${name}'";
featureLayer.setDefinitionExpression(esri.substitute({
name: dojo.trim(item.value)
}, query));
}
Here is my HTML:
<select id="mySelect" data-dojo-type="dijit.form.ComboBox" style="width:200px;font-size:16px;"
value="Select a genus" onchange="selectTree(this)" fetchProperties="{sort:[{attribute:'name', descending:false}]}">
</select>
Matthew,
I don't see anything wrong with the little bit of code snippets that you have provided so it might be an issue in you init function where you attempt to populate the dropdown with unique values.