Use Background Loading for Widgets

Optimize the performance of analytic applications with background loading of widgets.

With the background loading of widgets you can improve the startup performance of analytic applications that contain invisible widgets. When you start your application, all widgets (both set as visible or invisible) are initialized before the application starts.

As an application designer, you can change this default behavior and activate the loading of invisible widgets in the background. This way, all widgets that are initially visible are initialized at application start and displayed to the application user. In a second step, the invisible widgets are initialized in the background to be available if the application user works in the application and changes the visibility of the widgets.
Note

When we talk about invisible widgets, we talk about widgets with the property Show this item at view time switched off but also about widgets inside invisible panels or on tabs in tabstrips that are not active at startup.

The background loading increases the perceived startup performance of the application as the startup screen appears faster.

How to change the Default Behavior

To improve the performance and change the standard behavior, choose in the Edit Analytic Application ( ) menu Start of the navigation pathAnalytic Application Settings Next navigation step Load Invisible Widgets on InitializationEnd of the navigation path.

Using the URL Parameter loadInvisibleWidgets

For testing purposes (which mode is working better for the particular application) or if you want to enable the application user to overwrite your default setting (if the mode doesn't match the application user's expectations), the application user can use the URL parameter loadInvisibleWidgets. The URL parameter has two possible values:
  • loadInvisibleWidgets=onInitialization

    This forces the classical behavior and loads all widgets on initialization before the widget shows up.

  • loadInvisibleWidgets=inBackground

    This forces the background loading of invisible widgets after the initial visible widgets have shown up for the application user.

Advanced Background Knowledge and Tips

If the mode Load Invisible Widgets in Background is used, it's possible a script will try to access a widget that does not exist at that time. This is especially true for the onInitialization script. Therefore, there are some best practices to reveal the full potential of the optimization:
  1. Let the Load Invisible Widgets in Background event script empty.

  2. If step 1 is not possible, try to avoid accessing widgets that are not initially visible and, above all, don't use the setVariableValue API if it's not needed. If you want to set a variable initially to a static value, save the variable value state to design time with the application instead.

  3. If you need to prepare invisible widgets via scripting, do this directly before the widget becomes visible (by calling setVisible(true) or changing the tab in tabstrip) instead of doing this inside the onInitialization event script.

  4. If you can't avoid accessing an invisible widget inside the onInitialization event script, don't nest this widget too deep into a container structure like panels or tabstrips. Ideally, this widget is a direct child of the canvas.