Query/Hide Rows in Feature Table

1291
7
11-09-2021 09:25 AM
kjtrottier
New Contributor II

Hello,

I'm trying to query the feature layer/table so that the number of rows in the table decreases showing only the ones that meet the query requirement.  I able to do it on the feature layer referenced by the table so the map shows the desired result but the feature table stays the same. This was done using the feature layer queryFeatures method.

Looking at older posts using the 3.x api there was a method showSelectedRecords() which seemed to allow the user to select records and then only show those selected. There was also the filterSelectedRecords() method which was part of the feature table class which seems like it would also work.

In 4.x  I cannot find similar methods. (currently looking at 4.21)

Am I missing something and there is a method that would help similar to the ones mentioned or is there different way to go about hiding the rows in the feature table?  Or is this feature not yet implemented into the 4.x versions?

Thank You.

0 Kudos
7 Replies
ABishop
MVP Regular Contributor

Hello,

Not sure what you are using the feature layer for or where it is displayed. Is there a reason you are using JavaScript to do this?  You can do the same thin using a definition query in ArcMap or ArcGIS Pro.  

Amanda Bishop, GISP
0 Kudos
kjtrottier
New Contributor II

The feature layer is displayed on a web map that is part of a larger JavaScript application, which needs to be able to filter down the info in the table

Using ArcMap or ArcGIS Pro won't work for what I need to happen.

0 Kudos
ABishop
MVP Regular Contributor

Does the filter change?  If not, you could build the definition query into the service before publishing.

Amanda Bishop, GISP
0 Kudos
kjtrottier
New Contributor II

Yes, the filter needs to be able to change.

So at the start all the information is displayed on map and in the table.  Then I need to be able to hide the parts on the map and table that don't meet the requirement whatever it may be.  I have this working on the map/feature layer but the table always shows all the info.

0 Kudos
ABishop
MVP Regular Contributor

Is there a possibility of adding the web map to a web app builder and utilizing the query widget?  This would give you an opportunity to choose the results and also for your user to export them.

Amanda Bishop, GISP
0 Kudos
kjtrottier
New Contributor II

I don't believe so.  The application I'm trying to add this to already has working features with the API and consists of other aspects outside of the API.

ABishop
MVP Regular Contributor

I am not familiar with API but maybe there is a way to add a query widget?  This would give the users an option to set the queries on the fly through the interface. 

Amanda Bishop, GISP
0 Kudos