Select to view content in your preferred language

Changing widgets at runtime

851
4
Jump to solution
10-08-2019 08:51 AM
Phares_Andrew
New Contributor II

I'm trying to create a widget that lets the app's user select fields of a layer in a column, and then displays info for the selected field in a unique widget. (e.g. If I select Field A, then I display widget A. If I select field B, then I display widget B). I can communicate between widgets, but haven't seen any documentation on how to control loading / destroying of new widgets. I was looking into the infographics widget, and its configuration is referenced only in the main config.json, which would mean if I dynamically changed that at runtime, I'd have to reload the whole app. Is there a better way to go about this with custom widgets?

Tags (2)
0 Kudos
1 Solution
4 Replies
RobertScheitlin__GISP
MVP Emeritus

Phares,

  So are you saying that you do not want widget A to be loaded or even an option for loading  if the user selected field B?

0 Kudos
Phares_Andrew
New Contributor II

Yeah – where the widgets become dynamic features of the website that display information given the selection. Another example would be if I had a main view which would display the map, and I'd have my custom widget display a menu when pressed – then if I select item A from the list, then I load a Widget A into the map (e.g. like an infographics widget). I've made a global variable for the list item, but haven't been able to figure out loading widgets via javascript and not the config.json files

0 Kudos
shaylavi
Esri Contributor

I couldn't find a way to configure infographics from a different widget so I just created a graph of my own with a minimal set of configurations.. I reckon that would be easier than dynamically configure the settings of an existing widget.. even if you do manage to inject settings to the config json, I believe you need to reload the app as you said..

Shay
0 Kudos