JS Api 4.7 Sublayer.createFeatureLayer() is not working

514
3
06-19-2018 01:51 AM
AndriyGalayda
New Contributor II

I am working with MapImageLayer on map. As i need to update some data i am trying to create FeatureLayer from sublayer. But function Sublayer.createFeatureLayer()  returns error "Cannot read property 'clone' of null" . I see that property Sublayer.renderer is null and it causes this error. But i am not sure how to fix it. Any thoughts ?

0 Kudos
3 Replies
Noah-Sager
Esri Regular Contributor

Sorry for the late reply. Are you still having an issue with the createFeatureLayer() method? Do you have a code sample you could share? 

-Noah

0 Kudos
AndriyGalayda
New Contributor II

I solved this by using QueryTask.Get result as FeatureDataset and then just create FeatureLayer with this dataset

KristianEkenes
Esri Regular Contributor

Andriy,

If the renderer is null, you can pass a SimpleRenderer to it prior to calling the createFeatureLayer() method, and it should work.