One reason I was hesitant to adopt Experience Builder was its limited support for custom widgets that can work dynamically with whatever layers are currently on the map. The last time I evaluated it, a widget had to be configured at design time with specific layers, meaning you needed to know in advance which layers it would interact with.
In the applications I work on, users can load any layers into the map at runtime and then use a custom widget to operate on some or all of those layers.
So my question is: is this now possible in Experience Builder?
I just use this to detect the layers during runtime
arcgisMap.view.map.layers.map(async function (lyr) {
Solved! Go to Solution.
Yes. This is now possible in ArcGIS Experience Builder.
Custom widgets can now discover and react to layers at runtime, including layers users add dynamically.
You are no longer forced to bind widgets only to design-time layers.
How it works
In a custom widget (React + ArcGIS JS API), you can access the active map view and enumerate layers exactly like you’re doing:
const view = jimuMapView?.view;
view.map.layers.forEach((lyr) => {
// Works for layers added at runtime
console.log(lyr.title, lyr.type);
});
You can also:
Watch for layers being added/removed
Filter by layer type (FeatureLayer, GroupLayer, etc.)
Operate on all current layers without prior configuration
Key caveat
You still need map access via JimuMapView, but layer selection no longer has to be fixed at design time unless you want UI-driven configuration.
Bottom line
Experience Builder has matured:
Runtime layer discovery — supported
Dynamic user-loaded layers — supported
Hard design-time coupling — no longer required
Yes. This is now possible in ArcGIS Experience Builder.
Custom widgets can now discover and react to layers at runtime, including layers users add dynamically.
You are no longer forced to bind widgets only to design-time layers.
How it works
In a custom widget (React + ArcGIS JS API), you can access the active map view and enumerate layers exactly like you’re doing:
const view = jimuMapView?.view;
view.map.layers.forEach((lyr) => {
// Works for layers added at runtime
console.log(lyr.title, lyr.type);
});
You can also:
Watch for layers being added/removed
Filter by layer type (FeatureLayer, GroupLayer, etc.)
Operate on all current layers without prior configuration
Key caveat
You still need map access via JimuMapView, but layer selection no longer has to be fixed at design time unless you want UI-driven configuration.
Bottom line
Experience Builder has matured:
Runtime layer discovery — supported
Dynamic user-loaded layers — supported
Hard design-time coupling — no longer required
Thank you. I wasn’t aware of this, as it has been a while since I last reviewed ExB. It would be beneficial for application developers—especially those who are not familiar with React—to have a design-time option that allows layers to be added to the map at runtime.