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?
Solved! Go to Solution.
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).
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).
Thanks that worked!