I am trying to create a Web AppBuilder custom widget. The goal of the widget is to allow a user to fill in 3 text boxes (an ID and X,Y coordinates), and then when they click a button on the widget, the data will be submitted (using .applyEdits on a particular feature layer). See attached screenshot of widget.
But I am having trouble figuring out how to correctly access the map object from within a button click event. Here is basically what I am trying to do in a simplified way:
startup: function() {
this.inherited(arguments);
// This alert can access the map graphics layer ID's.
alert ("Show ID's (this works): " + this.map.graphicsLayerIds)
on(dom.byId("widget_button"), "click", function() {
// This alert results in error.
alert ("Show map ID (this DOES NOT work): " + this.map.graphicsLayerIds)
});
}