Hi
we have a FeatureTable widget showing some features from a previous rectangle selection.
The FeatureTable is related to the main layer.
So far so good.
We also have a filter dialog where one can define a definitionExpression which is applied to the same main layer. This leads to some features from the main layer will disappear from the map. So this also works as expected.
The thing is, that it seems, that due to the link between the FeatureTable widget and the layer given to that widget, the definitionExpression of the layer also applies to the FeatureTable.
Means: All features, filtered out are also not displayed any more in the FeatureTable.
I can imagine, that this is intendet behavior.
But: I dont want this.
I would like to keep all features from the point in time where I did the original selection.
When after that the definitionExpression changes, I do not want the FeatureTable to be changed.
But I want to keep functionality of the FeatureTable like check-selecting features in it and process several actions we appended to it (like highlight the Feature with a red circle around it).
In case a feature is not shown on the map due to the filter but is shown in the FeatureTable, I want to place this red circle on the map even the actual feature is not shown.
TL;DR:
Does anyone know any way to avoid the FeatureTable being filtered by the given layers definitionExpression?
Solved! Go to Solution.
A simple solution might be to load two copies of your FeatureLayer. One for the map and one for the Table. You could alter the renderer for the layer used in the Table so it doesn't display on the map.
A simple solution might be to load two copies of your FeatureLayer. One for the map and one for the Table. You could alter the renderer for the layer used in the Table so it doesn't display on the map.
Thanks for your quick response and the good first approach.
We already thought of a kind of that.
Because we still want so see changes of the feaures in the original layer (it is a wfs layer).
We could somehow create a copy of the layer (may there is an existing function), and remove the definitionExpression.
Then we try to register on the originals "refresh" event and also call refresh method on the copy-layer.
But your approach is slightly different by using an own fully loaded (duplicate) layer but only not showing it on the map.
All updates will stay the same, the definitionExpression will only be applied on the first one.
I will try to implement that and we will discuss it (this may take until after upcoming festive season).
Of course any other ideas are welcome as well.
We will go with a slighty different approach by creating a dummy feature Layer containing only the original objects and sending this into the FeatureTable.
Since there is no direct way to unlink the widget and our way is based on your suggestion, this one will be marked as accepted solution. Thanks.
Hi there,
When you apply a definitionExpression to a layer, it filters out any features that do not meet the specified criteria. This means that those features are excluded from processing. For example, the server will only return features that match the expression when you set a FeatureLayer.definitionExpression. This behavior is consistent across all feature-based layers.
If you need to filter data without excluding it from FeatureTable, you can use client-side filtering by setting the LayerView's filter property. This approach allows you to filter the data on the client side without impacting the availability of features in the FeatureTable.
This codepen shows this workflow: https://codepen.io/U_B_U/pen/dPbvxQR?editors=1000
Let me know if you need further clarification!
Thanks for the reply.
This sounds pretty good. I am just confused because I was sure that using the definitionExpression would be client-side too. We will test this one too and report back.
This works as described, unfortunately it also excludes the filtering from other elements too.