Select to view content in your preferred language

Confusion in how to manage data sources in 1.16

516
2
Jump to solution
12-10-2024 01:22 AM
IkelosDev
Emerging Contributor

I have upgraded to the newest version of experience builder as the functionality of being able to link certain data oriented widgets to the map is super useful, + being able to filter the table by extent of the map was a functionality i needed.. however...

In the newest version , the jimuMapView methods : addOrRemoveDataOnMap, drawDataOnMap, drawDataRecordSet and updateDrawnDataRecordSet have been removed and im confused on how exactly am i supposed to replace these?

I have a widget that needs to create data sources during runtime  and add /remove them to the map (i know add data already does this but my employer needed a custom behaviour on top of that) And upgrading has broken it because it used that method (addOrRemoveDataOnMap) 

Is there a substitute for those methods that i am not seeing?

 

 

0 Kudos
1 Solution

Accepted Solutions
QunSun
by Esri Contributor
Esri Contributor

Hi @IkelosDev 

In fact, addOrRemoveDataOnMap, drawDataOnMap, drawDataRecordSet and updateDrawnDataRecordSet are internal methods used by map message actions & data actions. In this release, we removed these codes and provided better alternatives.

Here is the code snippet to create layer by data source and add it to map.

async function addDataSourceToMap(jimuMapView, dataSource) {
  const layer = await dataSource.createJSAPILayerByDataSource();
  const jimuLayerView = await jimuMapView.addLayerAndCreateJimuLayerView(layer, dataSource);
  return jimuLayerView;
}

 

If you want to remove the created layer, you can call jimuMapView.removeJimuLayerView(jimuLayerView).  

 

 

View solution in original post

0 Kudos
2 Replies
QunSun
by Esri Contributor
Esri Contributor

Hi @IkelosDev 

In fact, addOrRemoveDataOnMap, drawDataOnMap, drawDataRecordSet and updateDrawnDataRecordSet are internal methods used by map message actions & data actions. In this release, we removed these codes and provided better alternatives.

Here is the code snippet to create layer by data source and add it to map.

async function addDataSourceToMap(jimuMapView, dataSource) {
  const layer = await dataSource.createJSAPILayerByDataSource();
  const jimuLayerView = await jimuMapView.addLayerAndCreateJimuLayerView(layer, dataSource);
  return jimuLayerView;
}

 

If you want to remove the created layer, you can call jimuMapView.removeJimuLayerView(jimuLayerView).  

 

 
0 Kudos
IkelosDev
Emerging Contributor

Thanks that worked!

0 Kudos