Clear filter in FeatureTable to show all records again

452
3
Jump to solution
08-27-2021 01:43 PM
mylonite
New Contributor

Hi all,

I'm working on an app that is fairly similar to this example: 

https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=highlight-features-by-ge...

My end users want to be able to draw on the map to select their points and have the table below filter to those results. This does that. However, when they clear the selection polygon from the map, the filter on the table isn't removed, and this is confusing to the end users.

Is there a way in the 4.x version of the API to clear the filter? It looks like back in 3.x there was a clearFilter() method, but this does not exist in 4.x.

Thanks in advance!

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Honored Contributor

You can make this small addition (line 5) to clear the filtered table (this would be line 231 in the sample).

document
  .getElementById("clear-selection")
  .addEventListener("click", () => {
    featureTable.clearSelection();
    featureTable.filterGeometry = null;
    polygonGraphicsLayer.removeAll();
  });

 

View solution in original post

3 Replies
KenBuja
MVP Honored Contributor

You can make this small addition (line 5) to clear the filtered table (this would be line 231 in the sample).

document
  .getElementById("clear-selection")
  .addEventListener("click", () => {
    featureTable.clearSelection();
    featureTable.filterGeometry = null;
    polygonGraphicsLayer.removeAll();
  });

 

mylonite
New Contributor

Thanks a bunch! That worked!

0 Kudos
UndralBatsukh
Esri Regular Contributor

Hi there, 

This is a bug in the SDK sample. We will get this fixed in the sample.

 

Thanks for bringing this issue to our attention, 

-Undral