I was hoping to find a way to use the bookmark widget as a way to turn on and off multiple layers at a time. I don't want the map extent to change, only the new layers to be displayed. In the section below (around line 665 of the widget tsx file, I tried removing jimuMapView.view.goTo section but that did not have the desired result. The bookmark would still change the map extent. My custom bookmark widget did not throw any errors when starting the client.
The question of turning multiple layers on and off using a button or other method has been discussed before. So far the only solution is to use different views. For my application I would like to use separate views for another purpose and would not want to manage 15-20 different views for simple layer toggles. I was able to this in Web AppBuilder. Any ideas to make this work in Experience Builder via a button or Bookmark widget would be much appreciated.
viewBookmark = (item: ImmutableObject<Bookmark>) => {
const { appMode, config } = this.props
const { jimuMapView } = this.state
const { extent, viewpoint } = item
const gotoOpts = { duration: AUTOPLAY_DURATION }
if (appMode === AppMode.Run) {
if (jimuMapView && jimuMapView.view) {
jimuMapView.view.type === '3d'
? jimuMapView.view.goTo(
this.Viewpoint.fromJSON(viewpoint),
gotoOpts
)
: jimuMapView.view.goTo(
this.Extent.fromJSON(extent),
gotoOpts
)
if (item.baseMap) {
const baseMapJson = item.baseMap.asMutable ? item.baseMap.asMutable({ deep: true }) : item.baseMap
jimuMapView.view.map.basemap = this.Basemap.fromJSON(baseMapJson)
}
if (item.timeExtent) {
const timeExtent = item.timeExtent.asMutable({ deep: true })
applyTimeExtent(jimuMapView, timeExtent)
}