In my 2D app, I have created a feature layer that references an ArcGIS Online portal item ID. It works great. I have configured my feature layer with all of the properties that I want. On AGOL, I've got more items that are very similar. The user only needs to see one at a time in the app. I thought "my feature layer works great, all I've got to do is, based on user input, update the portalItem property, and maybe refresh() or load() to display the layer using its new source". This does not seem to work. I just keep getting the original geography.
Am I missing something in thinking I could just update the portalItem id property? If each FeatureLayer has to be created fresh with its own portal id, then what is the most concise way to create like 20 analagous feature layers with identical properties except for a different portal item reference?
Solved! Go to Solution.
Hi there,
You cannot do that! The source of the layer cannot be changed once the layer is loaded. You have to create new FeatureLayers for each portalItem! You can then toggle the layer visibilities to show only one layer at a time.
Hi there,
You cannot do that! The source of the layer cannot be changed once the layer is loaded. You have to create new FeatureLayers for each portalItem! You can then toggle the layer visibilities to show only one layer at a time.
That then is what I'll do. Thanks for the confirmation!