Method for opening UX in a Cordova or Static HTML application

Description

Normally, this component is opened by making an Ajax callback to the server. In a mobile Cordova application, or a static HTML application, the device might not have a connection to the server and so making an Ajax callback is not possible. In this case you can render a pre-computed version of the target UX component.

Discussion

When you build a Cordova application you specify the name of the UX component that is the 'start-up' component. This is the UX that is loaded when the user taps on the application icon on the device home screen. Since the start-up component is physically part of the Cordova app, the application can be launched regardless of whether the mobile device has a connection or not.

A common design pattern is for this start up component to call child UX components. These child UX components can either be embedded into the start-up component (for example on a Panel Card that is not initially visible) or displayed in a popup window. Child components are loaded by making an Ajax callback to the server.

However, if you do not have a connection, you will not be able to make the callback to load the child component.

When you add an embedded UX Component to a UX, or when you use Action Javascript to define an event to open a child UX, you can specify that the child-UX should be precomputed.

In the image below, the Method for opening UX in a Cordova or Static HTML application for an embedded UX is shown in the Optimizations (PhoneGap/Static HTML) section.

images/pre-render_phonegap.gif

A similar property is also available in the Action Javascript builder for opening a child UX.

images/pre-computed.gif

The options for this property are:

Option
Description
Ajax callback

This is the default. An Ajax callback is made to the server and the component is rendered on the server and Javascript is returned to the client to show the child component.

Precomputed

The component is precomputed at the time the Cordova (or Static HTML) application is built. When the child component is loaded by the start-up component at run-time, there is no Ajax callback. The child component is loaded from a Javascript file that is part of the Cordova application. With this option, it does not matter if the device does not have a connection.

AjaxIfOnLine_PrecomputedIfOffLine

If the mobile device has a connection, an Ajax callback is made, but if there is no connection, the precomputed child component is loaded.

Dynamic

Allows you to call a Javascript function to make the decision about whether to load the child UX component by making an Ajax callback, or by loading the precomputed version. Your function should return either 'ajax' or 'precomputed'.

Benefits of the Precomputed Method

The primary benefit of the precomputed method is speed. No callback is necessary, so the child UX will load very quickly.

Limitations of the Precomputed Method

Since the child UX component is precomputed at the time the Cordova application (or Static HTML) application is build, there is no concept of what the user's security groups are and what the value of any session variables are. Therefore this option is not appropriate if you have any server-side show/hide expressions, or if certain controls have associated security settings. Also, any data in the component will have been rendered at design-time so you may need to write JavaScript code to set certain control values in the child UX after it has been rendered.

Limitations

Applies only to UX components