Select to view content in your preferred language

How to retrieve selected feature from widget?

776
3
09-02-2018 05:13 AM
LopezChepez
New Contributor

Hi,

I am customizing RelatedTableCharts widget. I want to get the info (coordinate/id) of the selected feature (point) before the widget is open. So that when I select a point (to show pop ups, related table), then open the widget, the chart of the point is already plotted without selecting the point again.

I believe the on click method won't works.

Or another way around, by triggering pops up. Open widget>select point>then both chart and pops up come out.

I believe the on click method won't works.

Please advise. I have been looking this for days.

Thanks, 

Chepez

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

Chepez,

   The way to go about this is to get a reference to the layer and use the getSelectedFeatures method. Assuming it is a FeatureLayer.

0 Kudos
ClémentLaskar
Regular Contributor

Hi,

I also have this question, as I can get selected features using getSelectedFeatures on a FeatureLayer, but cannot use it on a mapImageLayer.

The select widget can select features on a mapImageLayer and highlight them. Once it's done, is it possible to get those features?

Thanks !

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

When you select a sublayer of a ArcGISMapServiceLayer then a graphic display layer is created by the widget. The way you get the select graphic is to call the SelectionManagers getDisplayLayer method (which returns a GraphicsLayer) using the ID of the sub layer and then get that graphics array from that layers graphics property.

0 Kudos