I am creating a select features tool. It will work as follows:
So far so straightforward.
I also want the selected features to be highlighted when the layer selection is changed. To achieve this I have:
However, only the first feature in each layer is highlighted. Yet if I look at the query results in the browser console I can see multiple results are returned.
What am I missing?
Thanks,
Sarah Noakes
Cornwall Council
Solved! Go to Solution.
Hi Sarah,
Thanks for getting back to me. I've figured it out now - It was to do with how I was creating the FeatureLayer. I had:
featureLayerSelectManyURL = intranetMapServiceURL + "/" + arrTableIds[0];
featureLayerSelectMany = new FeatureLayer(featureLayerSelectManyURL, {mode: FeatureLayer.MODE_SELECTION});
whereas what I needed was:
featureLayerSelectManyURL = intranetMapServiceURL + "/" + arrTableIds[0];
featureLayerSelectMany = new FeatureLayer(featureLayerSelectManyURL, {mode: FeatureLayer.MODE_SELECTION, outFields: ["*"]});
Goodness only knows why defining the outFields makes as difference - but it does! Only took the best part of a day ;o)
Cheers,
Sarah.
Do you have any code you could share?
I did notice on the API page that for 'MODE_SELECTION' there are specific instructions about adding features:
Hi Sarah,
Thanks for getting back to me. I've figured it out now - It was to do with how I was creating the FeatureLayer. I had:
featureLayerSelectManyURL = intranetMapServiceURL + "/" + arrTableIds[0];
featureLayerSelectMany = new FeatureLayer(featureLayerSelectManyURL, {mode: FeatureLayer.MODE_SELECTION});
whereas what I needed was:
featureLayerSelectManyURL = intranetMapServiceURL + "/" + arrTableIds[0];
featureLayerSelectMany = new FeatureLayer(featureLayerSelectManyURL, {mode: FeatureLayer.MODE_SELECTION, outFields: ["*"]});
Goodness only knows why defining the outFields makes as difference - but it does! Only took the best part of a day ;o)
Cheers,
Sarah.