I'm trying to allow the user to edit a graphic (to drag the points on a polyline) by clicking on it - I'm using GraphicsLayer. https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/can-graphics-layers-be-queried/td-p/613949On this post, I read that queryFeatures are not available on GraphicsLayer, and in order to query it, you have to convert the GraphicsLayer into a FeatureLayer.
I tried the solution from that past, with this code:
```
let layer = new FeatureLayer({
source: tracksLayer.graphics._items,
objectIdField: "ObjectID"
});
arcgisView.whenLayerView(layer).then(function (lyrView) {
console.log(lyrView)
lyrView.watch("updating", function (val) {
if (!val) { // wait for the layer view to finish updating
lyrView.queryFeatures().then(function (results) {
console.log(results); // prints all the client-side graphics to the console
});
}
});
})
```
And I get the following error:
```{name: 'view:no-layerview-for-layer', details: {…}, message: 'No layerview has been found for the layer'}```
I'm not sure if using tracksLayer.graphics._items was correct. tracksLayer is my GraphicsLayer.
Also, I'm not sure of the use of objectIdField: "ObjectID" (I got that from the documentation).
Is there something I'm missing? Or is there another way to allow the user to edit the points on a polyline (in GraphicsLayer?) without being able to query it? This approach of having to change a GraphicsLayer to a FeatureLayer seems too complex, and maybe I should just redo everything and create a FeatureLayer from the start?
Thanks so much for the help!