Method for defining buttons


The choices in a ButtonList control can be statically defined using the ButtonList Builder or static JSON or dynamically computed using a Data Series or the Client-side Data Cache.


The Method for defining buttons defines how the options in a ButtonList control are computed. They can be calculated using one of the following methods:


The buttons are statically defined


Data is defined using a Data Series.


Data is defined as a static JSON string.


Data is defined using the Client-side Data Cache.

In a PhoneGap application, if the ButtonList's choices are computed using a Data Series, the Data Series is fetched when the application is published and is not recomputed until the application is published again at a later date.

 Populating from the Client-side Data Cache

You can specify that the data source for a ButtonList is a Client-side Data Cache item. This is particularly useful in PhoneGap applications that are designed to work offline. Here is why:

Say you build a UX component that has a ButtonList control and you specify that the control should be populated with data from a Data Series. At the time your PhoneGap application is built, the ButtonList with be populated with the data in the Data Series.

Once the PhoneGap app is installed on a device, the ButtonList will continue to have the data that was in the Data Series at the time the PhoneGap app was built. If you refresh the Data Series the ButtonList will now have up to date data, but this data has not been persisted on the device. So, this means that if you exit the App and re-launch it you are back to having stale data in the ButtonList. If you do not have a connection you would not be able to make a callback to the server to refresh the data in the ButtonList.

However, if you specify that the ButtonList is populated from data in a Client-side Data Cache, the Client-side Data cache will be refreshed automatically when the App is launched and then the ButtonList will be populated with the up-to-date data. The data that was retrieved from the server will be persisted on the device (assuming the Client-side Data Cache item was configured to persist data on the device). This means that if you exit the App and then re-launch it (while no connection is available), the ButtonList will be populated with the data that was fetched from the server the previous time the App was launched (presuming that at that time a connection to the server was available).