Hi,
I have a web map with a accident layer added. I have created web app builder application with this web map.
I have following widgets:
1) Layer List
2) Situation Awareness
3) Near Me
4) Info Summary
I have a custom widget for date selection. There is a date field in my accident layer. I want to refresh this layer which is already added on map based on the date filter.
Hoping for the positive response.
Regards,
Akshay Loya
Solved! Go to Solution.
Akshay,
In the web map (on AGOL/Portal) set a refresh interval on your layer if the data is updated frequently.
I want to refresh it based on where clause, this will change based on user selection.
Then in your custom widget just call
layer.refresh();
but how to put where clause on the layer already added on web map and refresh it?
This is the code I've written
Akshay,
Try this:
var layers = this.map.getLayersVisibleAtScale(this.map.getScale());
array.forEach(layers, function (layer) {
if (layer.id == 'Spills_map_series_3947') {
console.info(layer.className)
layer.setDefinitionExpression("County='KING'");
}
});
And show me what the console says
It is giving undefined.
Sorry for the late response. Somehow Geonet service was down.
My bad, I was trying it with map service. I changed it too feature service and it is working now.
Just need to apply for situation awareness widget now, somehow it doesn't take the filtered layer for query.