Monday, 24 July 2017

arcgis javascript api - Set definition expression from click event


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

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...