setData()

Load component data from a JSON stream into the specified uniface.Instance object.

ComponentInstance.setData(JsonStream);

Example: this.setData(vData);

Arguments

JsonStream—JSON stream containing serialized component information created by getData().

Return Value

None

Description

The setData() function enables you to load data that has been stored and then retrieved from a local datastore (using the uniface.datastore APIs), into a component instance. This enables you to load data that has already been downloaded without returning to the server, or to load modified data that was modified while there was no server connection prior to uploading it to the server. It is especially useful in mobile applications.

Using setData()

Assuming the data has been stored in a local database under the _id songs_dsp, the following code retrieves the data and loads it into the current DSP instance:

uniface.datastore.get('songs_dsp').then(function (vData) {
  uniface.getInstance().setData(vData.title);
});

Version

Change

9.7.03 G304 10.02.01

Introduced

Related Topics