Child pages
  • Online Mobile

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This allows to work with live data on the server, like foundsets with a million records.

Stoc

Concept

The Servoy find/search concept is extended to start with a local find and utilize a server side search.

Usage

...

Client Side

In the mobile solution you set a foundset into find mode and then add some criteria then instead of calling search() on the foundset, call remoteSearch on the mobile plugin:

...

Code Block
/**
 * @param {JSFoundSet} the foundset that was given to remoteSearch
 */
function successCallback(foundset) 
{
   if (foundset.getSize() >0) {
     // something found on the server show it in the current form
	controller.showRecords(foundset);
   }
}
/**
 * @param {Number} statusCode The http status code 
 * @param {String} message The message of the error
 * @param {JSFoundSet} foundset The foundset that was passed to remoteSearch
 */
function errorCallback(statusCode, message, foundset) 
{
	//do what ever is needed, like showing alert
}

 

Needs

...

Server Side

The plugins.mobile.remoteSearch() will call the service solutions 'offline_data' form 'ws_create()' method with the following signature:

...

All other global/shared foundsets will have all the new records and the existing records loaded, related foundset will be exactly the pk set that the server did return for it. Except new records on the client side, those will be inserted back in.

This does result in that the set of data in the mobile client does grow with every remoteSearch() call that gets new records, so calling clearData(), loadData() or doing a full sync() at certain times is recommended.

...