Displaying query results in a table in 4.20

173
2
09-17-2021 11:19 AM
luckachi
New Contributor III

I am trying to figure out if there is a way to display query results in a table. FeatureTable would be perfect but I get the impression that it doesn't work with a GraphicsLayer? I perform a query and then add the results to a Graphics Layer so the results are the only points displayed on the map. The popuptemplate works great for displaying information on the individual records when clicked but I would also like to allow the user to have a table visible so they can scroll through the results

0 Kudos
2 Replies
ChrisBoland
New Contributor II

I believe that ESRI has this code sample that does what you're trying to accomplish.
Select features by rectangle | ArcGIS API for JavaScript

luckachi
New Contributor III

Hi Chris,

I am having some trouble breaking down this example. I added  featureTable.selectRows(prjResults); to my getResults function. It successfully selects the query results in the table based on the item I select in the drop down but I am not quite sure how to go about just showing those selected rows in the table. I took some lines of code from the example but it doesn't seem to be doing anything.

This is the function that currently selects the query results in the table:

 

 

        /* Called each time promise is resolved.
        Loop through each results and assign symbol and PopupTemplate */
        function getResults(response) {
          var prjResults = response.features.map(function (feature) {
            feature.symbol = sym;
            feature.popupTemplate = popupTemplate;
            return feature;
          });
          resultsLayer.addMany(prjResults);

          //select rows in featuretable
          featureTable.selectRows(prjResults);


          /* Zoom to Extent */
          var AOI = response.features;
          view.goTo(AOI);
        }

 

 

 

0 Kudos