In previous releases of ArcGIS Experience BuilderJimu property. With the migration to the ArcGIS Maps SDK for JavaScript web components, the new pattern for accessing map views in Experience Builder is to use Jimu, which is supported by arcgis-map or arcgis-scene, instead of relying on the newly deprecated Jimu. This topic describes the recommended patterns for selecting and consuming map views, layers, and tables in your custom widget.
What has changed
The ArcGIS Maps SDK for JavaScript
- Previous pattern:
new MapandView() new Scene.View() - Current pattern:
arcgis-mapandarcgis-scene, exposed through Experience Builder map abstractions such asJimu.Map View
For most Experience Builder widgets, this means:
- Do not create map or scene views directly.
- Select and consume the active
Jimuthat is created and managed by the Map widget.Map View - Use ArcGIS map components and set
referenceto the map component element fromElement Jimu.Map View
Migration guidance
Use this mapping to migrate from the legacy pattern to the current Experience Builder pattern.
| Legacy pattern | Current pattern |
|---|---|
new Map / new Scene in widget code | Use Map in settings and Jimu in runtime |
| Widget owns the map view lifecycle | Map widget owns lifecycle; your widget consumes active Jimu |
component.view = jimu | component.reference |
jimu as primary popup entry point | jimu or jimu |
Widget settings and runtime patterns
The sections below describe the recommended new patterns for selecting and consuming map views, layers, and tables in your widget.
Select a map, layers, and tables in widget settings
To select a map, layers, and tables in your widget settings, use the following components:
-
Use
MapfromWidget Selector jimu-ui/advanced/setting-componentsso users can choose a Map widget.- Use the
oncallback to get selected map widget ID values.Select - Persist the selected ID list in widget config, usually via
use.Map Widget Ids - Although this is stored as an array, many widgets use
usewhen one map widget is expected.Map Widget Ids?.[0]
- Use the
-
Use
LayerfromSetting jimu-ui/advanced/setting-componentswhen the widget needs author-selected layers or tables.Layercan display both layers and tables.Setting - If your widget needs tables, ensure table display is enabled in
Layerconfiguration.Setting
Get the map, layers, and tables at runtime
-
To get access to the
Jimu:Map View - If you already have a
jimu, useMap View Id Map.View Manager.get Instance().get Jimu Map View By Id(jimu Map View Id) - The recommended pattern is to use
JimuwithMap View Component useand theMap Widget Id oncallback to get the activeActive View Change Jimu.Map View - Always call
await jimubefore using the view.Map View.when Jimu Map View Loaded()
- If you already have a
-
To get access to the
Jimu:Layer View - Use
jimufor already loaded layer views.Map View.get All Loaded Jimu Layer Views() - Use
await jimufor a specific layer view.Map View.when Jimu Layer View Loaded(jimu Layer View Id) - If you have a
Data, useSource await jimu.Map View.when Jimu Layer View Loaded By Data Source(ds) - Use
jimuto handle layer views created later.Map View.add Jimu Layer View Created Listener(listener) - Remove listeners when no longer needed.
- Use
Layer-view loading pattern
As a developer, you want to retrieve layer views as soon as they are available for your custom widget. Here are the recommended patterns:
- Avoid
await jimuunless you truly need every layer view. Waiting for all layer views can delay widget initialization.Map View.when All Jimu Layer View Loaded() - In most cases, use
getalong withAll Loaded Jimu Layer Views() add.Jimu Layer View Created Listener(listener)
Get the layer data source
When you want to retrieve the layer data source from a Jimu:
- Use
jimufor the bound layer data source ID.Layer View.layer Data Source Id - Use
jimuto access the layer data source.Layer View.get Layer Data Source() - If needed, call
await jimu.Layer View.create Layer Data Source()
Get the table data source
When you want to retrieve the Jimu and its corresponding table data source:
- Use
jimufor tables already created.Map View.get Jimu Tables() - Use
jimufor tables created later.Map View.add Jimu Table Created Listener(listener) - Use
jimuto clean up.Map View.remove Jimu Table Created Listener(listener) - Use
jimuandTable.table Data Source Id jimufor table data source access.Table.get Table Data Source() - If needed, call
await jimu.Table.create Table Data Source()
Using the ArcGIS Maps SDK for JavaScript components
With the migration to the component API model, as a developer, you should use the ArcGIS Maps SDK components instead of the deprecated ArcGIS Maps SDK core widgets. For example, use arcgis-layer-list instead of the deprecated Layer widget.
Recommended patterns
- When you need to use ArcGIS map components, import
loadfromArcGIS Map Components jimu-coreand call it to load the map component API. - Experience Builder now hosts map views through
arcgis-maporarcgis-scene. It is recommended to:- Set
component.reference. TheElement = jimu Map View.map Component jimuproperty points to the underlyingMap View.map Component arcgis-maporarcgis-scenecomponent. - Not rely on assigning
component.viewin your custom widget.
- Set
- When you need to access the popup in your custom widget, it is recommended to use:
jimuorMap View.map Component.popup Element jimu.Map View.get Popup Element() - Popup element events for popup state handling.
jimuandMap View.map Component.open Popup() jimu.Map View.map Component.close Popup()
Code example
Access the underlying ArcGIS Maps SDK view.
This example shows a basic widget runtime example that gets the active Jimu and reads the view type.
import { React, type AllWidgetProps } from 'jimu-core'
import { JimuMapViewComponent, type JimuMapView } from 'jimu-arcgis'
export default function Widget (props: AllWidgetProps<any>) {
const [jimuMapView, setJimuMapView] = React.useState<JimuMapView | null>(null)
const onActiveViewChange = async (activeView: JimuMapView) => {
if (!activeView) {
setJimuMapView(null)
return
}
await activeView.whenJimuMapViewLoaded()
setJimuMapView(activeView)
}
return (
<div className='widget-use-mapview-sceneview'>
<JimuMapViewComponent
useMapWidgetId={props.useMapWidgetIds?.[0]}
onActiveViewChange={onActiveViewChange}
/>
{jimuMapView?.view && (
<div>
Active view type: {jimuMapView.view.type}
</div>
)}
</div>
)
}