FeatureTable selected row not highlighted on map

267
2
09-05-2022 02:17 AM
PL1
by
New Contributor II

Hello I am using arcgis/core version 4.21.2. I am creating a web application based on ArcGIS API for JavaScript.

My problem is that I am not able to highlight selected rows on map. My code is the following

 

const [featureTable, setFeatureTable] = useState(null as any);

useEffect(() => {
    const map = new Map({
      basemap: "arcgis-topographic",
      layers: layers.map((layer, index) => layer.mapImageLayer),
    });
    
    const view = new MapView({
      zoom: INITIAL_ZOOM,
      center: LOCATION_CENTER,
      map: map,
    });

    const initWidgetParams = {
      allotmentRef: allotmentRef,
      globalFeatureTable: new FeatureTable({
        view: view,
        menuConfig: {
          items: []
        }
      }),
      featureTableVisibility: false,
      view: view
    };

    view.when(() => { 
      initWidgets(initWidgetParams)
    });

    setFeatureTable(initWidgetParams.globalFeatureTable);
  }, []);

 

 

I hope the code is clarifying.

0 Kudos
2 Replies
ReneRubalcava
Frequent Contributor

At a glance, it doesn't look like you are adding the layer to the FeatureTable.

Would need a simpler codepen or similar if that doesn't fix it.

0 Kudos
PL1
by
New Contributor II

Hello and thank you for the response!

I did not post a larger snippet as the program is quite large. Inside the InitWidgets function I set the layer to the FeatureTable this way 

 

layerList.on("trigger-action", function(event: { item: any; action: any }) {
  const layer = event.item.layer;
  layer
    .createFeatureLayer()
    .then((featureLayer: FeatureLayer) => {
      globalFeatureTable.layer = featureLayer;
      return featureLayer.load();
    })
})

 

 where the layerList is a LayerList widget.

0 Kudos