I'm trying to set a definition expression according to a user-selected value from a drop down menu, but I can't get the map to update the feature layers according to the expression. The user is able to click the drop down and select the values, but nothing happens when they click one.
HTML:
JS:
//creates and adds feature layers to map
var generalIssuePoints = new FeatureLayer(".../FeatureServer/0", {
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ["*"]
});
var firePullPoints = new FeatureLayer(".../FeatureServer/1",{
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ["*"]
});
map.addLayers([generalIssuePoints, firePullPoints]);
//handles drop-down change event
on(dom.byId("level"), "change", function(e) {
var level = e.target.value;
var definitionExpression = "LEVEL_ = " + level;
//sets definition expression
generalIssuePoints.setDefinitionExpression(definitionExpression);
firePullPoints.setDefinitionExpression(definitionExpression);
});
No comments:
Post a Comment