As the tile says, I'd like to run the filter out of view in the background and perform a query on an expression without user's action. How can execute in the background the expression defined in the config_Filter.json?
Thanks.
Lefteris,
Sure just add the FilterManager require to what ever js code you want (like MapManager) and use a line like this:
FilterManager.getInstance().applyWidgetFilter(layerId, null, "your sql expression");
Thank you Robert. It works. However, since I am using tens of custom config.json files that are called in the url, ideally I would like to use something like the FilterManager.getInstance() (no sql statement) in AT (for example) and let the custom config.json call the custom config_Filter.json for the SQL expression (as it is already set up). Can it be done?
Thanks.
Lefteris,
Sure you will need to use the appConfig var (this.appConfig) and loop through it to find the filter widget and then look at the config property and then the filters property to get the layerId and filter.expr
Thanks.
So, if the widget is already openAtStart (true) and not visible, I can use this method to call an instance of the widget and execute the filter operation based on the custom_Filter?
require(["jimu/WidgetManager"], function(WidgetManager) {
var wm = WidgetManager.openWidget("Filter");
});
Lefteris,
No the widget does not have to be openAtStart or visible as the only thing you will be using from the widget itself is the widget config files.