empty JimuLayerViews after creating JimuMapView using WebMap ID

182
4
a week ago
MohammedHilal_K
New Contributor III

Hi Team,

am developing an custom widget which can switch the webmap dynamically. Successfully am able to switch the webmap, but i noticed, after switching the webmap, selection on features is not working. So I did some research and find something like need to create jimuMapView to solve this. I could able to create a JimuMapView. But theres is no JimuLayerView and Maptool. Any help would be appreciated.

 

thanks & regards,
Mohammed Hilal K

0 Kudos
4 Replies
QunSun
by Esri Contributor
Esri Contributor

Hi MohammedHilal_K,

Currently only Map widget can create JimuMapView. Can you share your code to create JimuMapView in the custom widget ?

 

0 Kudos
MohammedHilal_K
New Contributor III

hi @QunSun,

Here is the code where I'm trying to create a JimuMapView. I'm not sure this is the correct method to do.

let jmvConstructorOptions:JimuMapViewConstructorOptions={
  view:views.view,
  dataSourceId:webmapId,
mapWidgetId:"widget_23",
mapViewManager:mvManager,
  }
mvManager.createJimuMapView(jmvConstructorOptions).then(newJMV)

here, I'm passing WebMapId as dataSourceId. 

Actually my requirement is to make the feature layer selectable even after switching the map programmatically. May be if I can change the Map Widget data source, I could resolve my issue. Can you help me out? 
0 Kudos
QunSun
by Esri Contributor
Esri Contributor

Hi MohammedHilal_K,

The webmapId is not the correct dataSourceId. Data source is a concept in Experience Builder. The only way to select a webmap/webscene data source is using the left data panel.

QunSun_0-1719296879642.png

Then you can check the dataSourceId by _appState.appConfig.dataSources in the console.

QunSun_1-1719296996660.png

Here is an example. The dataSourceId of the webmap is "dataSource_1", not the webmapId "33e58168249b42d49c4fb1b4f27728db".

0 Kudos
MohammedHilal_K
New Contributor III

Hi @QunSun,
I understood your point. The dataSourceId is generated by Experience it self while we select the webMap. 
My concern is, when I change the webmap like 'jimuMapView.view.map=newMap', the interactions like selection, is not happening. My understanding is, That is because of no JimuMapView has been created and using the existing one. 

Am developing an custom widget which can get the WebMapId and create a webmap and change the existing WebMap. The user may can do this repeatedly based on the requirement. 


Is there any way to handle this? Or this is not possible in experience builder? 

0 Kudos