Select to view content in your preferred language

layer.getselectedFeature in ArcGIS JS 3.xx

1133
2
Jump to solution
06-18-2020 02:03 AM
VictorTey
Esri Contributor

Hi, I have searched high and low and there simply isn't a way to determine if a feature have been selected on a layer in ArcGIS Javascript 3.xx. (in PRO SDK, its literally a one-liner)

My use-case requires me to determine the features that are selected in the attribute-table widget and the only way I can achieve that is by digging in the layer and search for _graphicalVal. I am sure there must be a proper way to do this, perhaps through a proper API? Would anyone be able to advise?

I could not find anything in the layers api, layersInfo/Struct/Node etc api

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Victor,

   Where is your code that needs to know the selected features? In a Widget or in one of the jimu.js mangers? Normally I would get a reference to the AT widget and then _activeTable.layerInfo or .layer to get the layer that the active table represents. You can get an array of selected OIDs from the _activeTable.selectionRows variable or get the actual selected features(graphics) using _activeTable.layer.getSelectedFeatures()

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

Victor,

   Where is your code that needs to know the selected features? In a Widget or in one of the jimu.js mangers? Normally I would get a reference to the AT widget and then _activeTable.layerInfo or .layer to get the layer that the active table represents. You can get an array of selected OIDs from the _activeTable.selectionRows variable or get the actual selected features(graphics) using _activeTable.layer.getSelectedFeatures()

0 Kudos
VictorTey
Esri Contributor

Thank you so much Robert Scheitlin, GISP that is very helpful.

Cheers

0 Kudos