WAB - update NearMe widget configuration programmaticlly

10-04-2022 07:18 AM
Labels (1)
New Contributor III

Web AppBuilder 2.21 Developer Edition

Hey all,

I'm trying to change the configuration of the NearMe widget. I've generated both of the config files from WAB. I tested the widget with each file and is working fine. Now, I did'nt want to duplicate the widget and I would like to alternate bitween the two configurations. I've added two radio buttons to handle the user action.

Here a snnipt of my code

function changeConfig(PanelManager, WidgetManager) {
let mywidget = PanelManager.getInstance().widgetManager.loaded.filter((item) => {return item.name == 'NearMe'});
const button1 = document.getElementById('button1')
const button2 = document.getElementById('button2')
button1 && button1.checked ? mywidget[0].config = config1 : null;
button2 && button2.checked ? mywidget[0].config = config2 : null;
//destroy the widget with olde config
//start the widget with the new config


Is there any chance to do that ? I saw a related answer here https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-modify-widget-config-pr...
that would not possible but still trying to get that worked ...


Thanks a lot


Tags (2)
0 Kudos
0 Replies