Skip To Content
ArcGIS Developer
Dashboard

Build your first app

ArcGIS Web AppBuilder is a map-centric application. It provides a map property defined in the BaseWidget class to access the map. You can access the map property through this map. The widget’s map property is a type of esri.Map from ArcGIS API for JavaScript, configured in the config.json file. You can access all map features provided by ArcGIS API for JavaScript. Code the widget the same as you would write a regular ArcGIS JavaScript application.

When a widget instantiates, the map passes into it. As a result, you can access a map property in the postCreate or startup methods.

Modify the UI template and add a div tag to display the map ID property:

<div>
    <div>${nls.label1}.</div>
    <div>${nls.label2}.[${config.configText}]</div>
      <div data-dojo-attach-point="mapIdNode"></div>
</div>

Add JavaScript code to Widget.js to access the map:

startup: function(){
  this.inherited(arguments);
  this.mapIdNode.innerHTML = 'map id:' + this.map.id;
}

For a 3D widget, the map property is replaced by sceneView. Use this.sceneView to access the scene in your widget.