I'm trying to create a custom WAB widget that shows the locations of restaurants that are within a mile radius from an address that the user enters. I'm using the Yelp API through an esriRequest call. The results contain that lat/long of the restaurants. These lat/long values are what I want to use for the location of the graphics. It appears that creating the graphic is successful, but when I use this.map.graphics.add(graphic) I get an error message of init.js:114 TypeError: Cannot read property 'add' of undefined
Any help would be greatly appreciated!
Solved! Go to Solution.
Robert,
I tried using the .applyEdits, but the layer didn't draw and there were no features in the feature layer.
Michael,
You have to have something off in your widget code again then. I use a FeatureLayer from a collection in several of my custom widgets like the eSearch and Identify widget and I do not have an issue.
Robert,
I ended up adding each graphic individually to the feature layer in my for loop. This might not be the most correct way of adding the graphics to the feature layer, but it worked.
I really appreciate all your help!