Select to view content in your preferred language

Is it possible to activate a non-default widget on app load?

502
3
05-03-2023 12:32 AM
ViktorSafar
Occasional Contributor II

We have a WAB app that has several custom widgets. One of the widgets (a "Welcome" widget) is set as default. There is another widget (a "Feature editor") that has the capability to, based on URL params, identify a feature in a layer on the map and zoom directly to it and present attributes editor.

The app uses Foldable theme which is a standard in the organization.

A standard process is that users click on a link to this WAB app where the link contains the URL params that identify the feature for the "Feature editor" widget, and the expectation is that the link will take the user directly into the widget and presents the feature.

The problem is that since the "Feature editor" widget is not active on app load (as the default widget in the app is the "Welcome" widget), users are never taken to the feature and only presented with the Welcome widget. As mentioned, the app uses the Foldable theme which allows only a single widget at a time to be active within the Header controller.

Is there a way to activate a non-default widget on app load? Maybe via a URL param?

Tags (2)
0 Kudos
3 Replies
BrianLeroux
Regular Contributor

By "Welcome" widget are you referring to the Splash Widget? I also am not sure what you mean by default widget. However I might be able to help. In WAB Dev you can have a splash screen which will open first and the map will load behind it. You can set any other custom widget to open automatically. This is done by utilizing the little circle that appears on the lower left corner of the widget when adding the widget to your app. The image below is my widget with it enabled to turn on by default. In my example the splash screen opens but this widget and map loads behind it so when the user clicks through the splash screen, everything is ready to go. Hope this helps. If not clarify a bit further and i will see how i can help.

BrianLeroux_0-1683116082421.png

 

ViktorSafar
Occasional Contributor II

Hi Brian, by default I mean the widget marked with dot in lower left corner. A widget marked as such will open on app load so I call it "default widget".

"Welcome" widget is just a name we use for a custom widget. It is not the Splash screen. 

To abstract it a bit more: one widget in the controller is marked with the dot so it opens when the app loads, but in certain scenarios I need to open another widget when the app loads.

0 Kudos
BrianLeroux
Regular Contributor

OK That makes it a bit more clear. I am not sure I fully understand your requirements  but I think I would just put logic in your welcome widget that determines when/if the second widget should be opened. Then depending if it is in panel or off panel widget, call the openPanel or openWidget function. If you need to close the welcome widget first you can do that as well. Here is a link to the close widget documentation and Open will be similar. close-widget-programmatically 

0 Kudos