Select to view content in your preferred language

Custom Widget pre-open code

742
3
08-13-2018 01:09 PM
SamuelAbati
Occasional Contributor

Is it possible to have a code/function that executes before a custom on-panel widget is opened?

For example I want it to hook a button in the Map's popup that will then call the widget if it's not open.

A off-panel widget or external configuration wouldn't be ideal, I need this to be inside the Widget's scope and keep it modular.

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

Samuel,

   No any code inside the widget code base will not be executed until the widget itself is added.

0 Kudos
SamuelAbati
Occasional Contributor

Following my question :

"For example I want it to hook a button in the Map's popup that will then call the widget if it's not open."

How would you design a solution for this? Like how the edit widget adds a "edit" button in the popup.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Samuel,

   The edit action is registered in the popup by the FeatureActionManager.js because it is in the Edit widgets manifest.json. The action will be added to the popup and the WidgetManager will launch the edit widget because it listens for the builder/actionTrigger topic and if the widget is not already opened it will be loaded.

0 Kudos