Hi Team,
I need to implement a functionality of saving the newly created bookmarks. I see in he old 3.33 version using esri/digit there is an option implemented to store in the client but I can use the same to take the value and pass it to my custom service.
However for the new 4.16 library, I don't see any event for edit/remove etc or even for add.
How can I achieve this with the new library?
Solved! Go to Solution.
Read more about watch here:
Programming patterns | ArcGIS API for JavaScript 4.16
However, since the bookmarks property is a collection, you have to set an event handler.
Not all properties can be watched, including collections. Register an event handler to be notified of changes to a collection.
Note: Because both the
FeatureLayer.source
andGraphicsLayer.graphics
properties are collections, useon()
instead ofwatch()
to be notified of changes to the values of these properties.
George,
In 4.x you would Watch the bookmarks property. Many things that were Event'd in 3.x are not in 4.x as you can just watch properties for changes.
Read more about watch here:
Programming patterns | ArcGIS API for JavaScript 4.16
However, since the bookmarks property is a collection, you have to set an event handler.
Not all properties can be watched, including collections. Register an event handler to be notified of changes to a collection.
Note: Because both the
FeatureLayer.source
andGraphicsLayer.graphics
properties are collections, useon()
instead ofwatch()
to be notified of changes to the values of these properties.
Thanks a lot Robert Scheitlin, GISPand Ken Buja! You guys are awesome. These pointers actually helps me clear some of my concepts and main confusion with how the watch and on worked and this makes sense.
Since I am mainly concerned with the BookmarksWidget.bookmarks Collection, I will go with the .on("change") and play around with it.
I just have a concern on how it will trigger for edit operation as I see only event.added, event.moved and event.removed while there is an Edit operation allowed for bookmarks. I will check if the its getting captured in the added, if not, I will reach out to either of you.
Hello @GeorgeAbraham , did you find it out? how to trigger for add, remove, and edit?