Child pages
  • mobile

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
{div:style=}
Wiki Markup
Div
styledisplay:none

DO

NOT

EDIT

THE

CONTENT

OF

THIS

PAGE

DIRECTLY

(EXCEPT

INSIDE

THE

DIV

BELOW

WITH

ID=DESCRIPTION),

UNLESS

YOU

KNOW

WHAT

YOU'RE

DOING.


THE

STRUCTURE

OF

THE

CONTENT

IS

VITAL

IN

BEING

ABLE

TO

AUTO

UPDATE

THE

CONTENT

THROUGH

THE

DOC

GENERATOR.

\\ \\ Enter additional information related to this



Enter additional information related to this 'class'

inside

the

\

{div}

macro

with

'id=description'

{div} {div:id=description}{div}\\ {table:id=|class=servoy sReturnTypes}{tr:style=height: 30px;}{th}Return Types{th}{tr}{tr}{td}{td}{tr}{table}\\ {table:id=|class=servoy sSummary}{colgroup}{column:width=80px|padding=0px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Property Summary{th}{tr}{table}\\ {table:id=|class=servoy sSummary}{colgroup}{column:width=80px|padding=0px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Method Summary{th}{tr}{tbody}{tr}{td}void{td}{td}[#call]\(telNumber) Initiate a phone call{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#clearLocalData]\() Clears local data \- that is stored in browser local storage.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#email]\(emailAddress) Initiate an email sending{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#getCurrentPosition]\(successCallback, errorHandler, options) Wrapper function around HTML5 getCurrentPosition.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#getMarkupId]\(element) Retrieves markup id of an element{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#getUsedStorageSpace]\() Retrieves amount of used bytes from browser local storage.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#isOnline]\() Returns whether mobile device is online.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#loadData]\() (Re)Loads fresh data from the server, discarding the current local changes (asynchronously).{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#loadData]\(successCallback, errorHandler) (Re)Loads fresh data from the server, discarding the current local changes (asynchronously).{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#syncData]\() Synchronises data between Mobile Client and Servoy Application Server (asynchronously).{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#syncData]\(successCallback, errorHandler) Synchronises data between Mobile Client and Servoy Application Server (asynchronously), calling "successCallback" on successful synchronisation, with first argument the size of the received data in bytes, or "errorHandler" if an error occurs during synchronisation, with first argument the HTTP status code for the request or \-1 if unknown, and the second argument the error message.{td}{tr}{tbody}{table}\\ {table:id=property|class=servoy sDetail}{colgroup}{column:width=100%|padding=0px}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Property Details{th}{tr}{table}\\ {table:id=function|class=servoy sDetail}{colgroup}{column:width=100%|padding=0px}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Method Details{th}{tr}{tbody:id=call-String}{tr:id=name}{td}h6.call{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}call{span}{span}\(telNumber){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Initiate a phone call{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} telNumber -- telephone number to call {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}

Div
iddescription


HTML Table
id
classservoy sReturnTypes
Table Row (tr)
styleheight: 30px;
Table Head (th)
Return Types
Table Row (tr)
Table Cell (td)


HTML Table
id
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Property Summary

HTML Table
id
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#call(telNumber)
Initiate a phone call
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#clearLocalData()
Clears local data - that is stored in browser local storage.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#email(emailAddress)
Initiate an email sending
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#getCurrentPosition(successCallback, errorHandler, options)
Wrapper function around HTML5 getCurrentPosition.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getMarkupId(element)
Retrieves markup id of an element
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#getUsedStorageSpace()
Retrieves amount of used bytes from browser local storage.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#isOnline()
Returns whether mobile device is online.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#loadData()
(Re)Loads fresh data from the server, discarding the current local changes (asynchronously).
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#loadData(successCallback, errorHandler)
(Re)Loads fresh data from the server, discarding the current local changes (asynchronously).
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#syncData()
Synchronises data between Mobile Client and Servoy Application Server (asynchronously).
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#syncData(successCallback, errorHandler)
Synchronises data between Mobile Client and Servoy Application Server (asynchronously), calling
"successCallback" on successful synchronisation, with first argument the size of the received data in bytes,
or "errorHandler" if an error occurs during synchronisation, with first argument the HTTP status code for the request or -1 if unknown, and the second argument
the error message.

HTML Table
idproperty
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Property Details

HTML Table
idfunction
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Method Details
Table Body (tbody)
idcall-String
Table Row (tr)
idname
Table Cell (td)
call
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
call
Span
(telNumber)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Initiate a phone call
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} telNumber – telephone number to call
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

plugins.mobile.call("+490111111")
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=clearLocalData}{tr:id=name}{td}h6.clearLocalData{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}clearLocalData{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Clears local data \- that is stored in browser local storage. After calling this method there will be no data in the mobile client until a syncData/reloadDataFromServer operation completes successfully. Note: It is the caller's responsibility to show a form that doesn't need data or call a sync afterwards. (table structure data is cleared as well) Use this with care!{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idclearLocalData
Table Row (tr)
idname
Table Cell (td)
clearLocalData
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
clearLocalData
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent

Clears local data - that is stored in browser local storage.
After calling this method there will be no data in the mobile client until a syncData/reloadDataFromServer operation completes successfully.

Note: It is the caller's responsibility to show a form that doesn't need data or call a sync afterwards. (table structure data is cleared as well)
Use this with care!

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

// if we want do clear local copy of the data because the user did something really bad with local data
plugins.mobile.clearLocalData();
plugins.mobile.syncData();

// maybe we are done with a task and we don't want to use persistent space on the device
plugins.mobile.clearLocalData();
forms.noDataInitialForm.showWithMessage("Local data discarded."); // a form that displays the message and shows itself on this call; it also allows doing a sync later for example
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=email-String}{tr:id=name}{td}h6.email{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}email{span}{span}\(emailAddress){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Initiate an email sending{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} emailAddress -- destination email address {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idemail-String
Table Row (tr)
idname
Table Cell (td)
email
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
email
Span
(emailAddress)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Initiate an email sending
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} emailAddress – destination email address
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

plugins.mobile.email("[email protected]")
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetCurrentPosition-Function_Function_Object
}{
Table Row (tr)
:
id
=
name
}{td}h6.getCurrentPosition{td}{tr}{tr:id=sig}{td}{span:style=
Table Cell (td)
getCurrentPosition
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right:
5px;
}
void
{span}{span:style=
Span
stylefont-weight:
bold;
}
getCurrentPosition
{span}{span}\
Span
(successCallback,
errorHandler,
options)
{span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Wrapper function around HTML5 getCurrentPosition. Method will call successCallback method with a Position object argument if GPS position was retrieved. Otherwise will call errorHandler with an error argument. This method has dummy implementation in developer. NOTE: For options you can specify (a) Accuracy of the returned location information (b) Timeout for retrieving the location information and (c) Use of cached location information{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Function]} successCallback -- Method to be called if the coordinates are retrieved. \{[Function]} errorHandler -- Method to be called if an error occurs while retrieving GPS coordinates. Can be null. \{[Object]} options -- JSON string with different options that are supported by HTML5 function (accuracy, timeout, caching). {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Wrapper function around HTML5 getCurrentPosition. Method will call successCallback method with a Position object argument if GPS position was retrieved. Otherwise will call errorHandler with an error argument. This method has dummy implementation in developer.
NOTE: For options you can specify (a) Accuracy of the returned location information (b) Timeout for retrieving the location information and (c) Use of cached location information
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{Function} successCallback – Method to be called if the coordinates are retrieved.
{Function} errorHandler – Method to be called if an error occurs while retrieving GPS coordinates. Can be null.
{Object} options – JSON string with different options that are supported by HTML5 function (accuracy, timeout, caching).
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

plugins.mobile.getCurrentPosition(forms.myform.showLocation,scopes.globals.errorHandler,{timeout:5000});
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getMarkupId-RuntimeComponent}{tr:id=name}{td}h6.getMarkupId{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getMarkupId{span}{span}\(element){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Retrieves markup id of an element{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[RuntimeComponent]} element -- to retrive markup id for {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the element's markup id{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetMarkupId-RuntimeComponent
Table Row (tr)
idname
Table Cell (td)
getMarkupId
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getMarkupId
Span
(element)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Retrieves markup id of an element
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{RuntimeComponent} element – to retrive markup id for
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String – the element's markup id
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

var id = plugins.mobile.getMarkupId(elements.myButton)
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getUsedStorageSpace}{tr:id=name}{td}h6.getUsedStorageSpace{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}getUsedStorageSpace{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Retrieves amount of used bytes from browser local storage. The storage amount depends on used browser, but, from specification, the browser should allow at least 5MB of local storage. Note: Some browsers take two bytes per character.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetUsedStorageSpace
Table Row (tr)
idname
Table Cell (td)
getUsedStorageSpace
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
getUsedStorageSpace
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent

Retrieves amount of used bytes from browser local storage.
The storage amount depends on used browser, but, from specification, the browser should allow at least 5MB of local storage.

Note: Some browsers take two bytes per character.

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

var usedSpace = plugins.mobile.getUsedStorageSpace()
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=isOnline}{tr:id=name}{td}h6.isOnline{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}isOnline{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns whether mobile device is online. Returns true in developer implementation.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idisOnline
Table Row (tr)
idname
Table Cell (td)
isOnline
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
isOnline
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns whether mobile device is online. Returns true in developer implementation.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

plugins.mobile.isOnline()
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=loadData}{tr:id=name}{td}h6.loadData{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}loadData{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}(Re)Loads fresh data from the server, discarding the current local changes (asynchronously). It is equivalent to the "load" part of a sync operation; it doesn't send local changes to the server and discards local changes when it receives new data from the server. When done, this call might (and most of the time does) need to move to first form, as the (new) local data might be completely different \- invalidating the current form/history.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idloadData
Table Row (tr)
idname
Table Cell (td)
loadData
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
loadData
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent

(Re)Loads fresh data from the server, discarding the current local changes (asynchronously).
It is equivalent to the "load" part of a sync operation; it doesn't send local changes to the server and discards local changes when it receives new data from the server.

When done, this call might (and most of the time does) need to move to first form, as the (new) local data might be completely different - invalidating the current form/history.

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

// reload data from server and discard local changes
plugins.mobile.loadData();
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idloadData-Function_Function
}{
Table Row (tr)
:
id
=
name
}{td}h6.loadData{td}{tr}{tr:id=sig}{td}{span:style=
Table Cell (td)
loadData
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right:
5px;
}
void
{span}{span:style=
Span
stylefont-weight:
bold;
}
loadData
{span}{span}\
Span
(successCallback,
errorHandler)
{span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent

(Re)Loads

fresh

data

from

the

server,

discarding

the

current

local

changes

(asynchronously).


It

is

equivalent

to

the

"load"

part

of

a

sync

operation;

it

doesn't

send

local

changes

to

the

server

and

discards

local

changes

when

it

receives

new

data

from

the

server.

When

done,

this

call

might

(and

most

of

the

time

does)

need

to

move

to

first

form,

as

the

(new)

local

data

might

be

completely

different

\

-

invalidating

the

current

form/history.


As

callback

methods

are

set,

the

call

back

methods

will

be

responsible

for

doing

this

themselves

\

-

for

example

using

and

controller.show()

of

the

first

form.

{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Function]} successCallback -- Method to be called if the load was successful. Can be null. First argument of the success callback is the size of received data in bytes. \{[Function]} errorHandler -- Method to be called if an error occurs during load. Can be null. First argument is the HTTP status code for the request or \-1 if unknown. Second argument is the error message. {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}

Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{Function} successCallback – Method to be called if the load was successful. Can be null.
First argument of the success callback is the size of received data in bytes.
{Function} errorHandler – Method to be called if an error occurs during load. Can be null.
First argument is the HTTP status code for the request or -1 if unknown.
Second argument is the error message.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

function reloadAndDiscardData(event)
{
	plugins.mobile.loadData(onLoadSuccess, onLoadError);
}
 
function onLoadSuccess(dataBytes)
{
	if (dataBytes > 0) forms.contacts.showContacts(accountmanager_to_companies.companies_to_contacts);
	else forms.noData.showWithMessage("Server has no data to send.");
}
 
function onLoadError(http_status_code, error_message)
{
	plugins.dialogs.showWarningDialog("Warning", 'Reload of data failed with http status code: ' + http_status_code + ', and error message: ' + error_message);
	forms.firstForm.showWithMessage("Data reload failed. Please press 'Synchronise' to try again.");
}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=syncData}{tr:id=name}{td}h6.syncData{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}syncData{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Synchronises data between Mobile Client and Servoy Application Server (asynchronously). When done, this call might (and most of the time does) need to move to first form, as the (new) local data might be completely different \- invalidating the current form/history.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsyncData
Table Row (tr)
idname
Table Cell (td)
syncData
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
syncData
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent

Synchronises data between Mobile Client and Servoy Application Server (asynchronously).

When done, this call might (and most of the time does) need to move to first form, as the (new) local data might be completely different - invalidating the current form/history.

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

plugins.mobile.syncData()
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsyncData-Function_Function
}{
Table Row (tr)
:
id
=
name
}{td}h6.syncData{td}{tr}{tr:id=sig}{td}{span:style=
Table Cell (td)
syncData
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right:
5px;
}
void
{span}{span:style=
Span
stylefont-weight:
bold;
}
syncData
{span}{span}\
Span
(successCallback,
errorHandler)
{span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Synchronises data between Mobile Client and Servoy Application Server
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent

Synchronises data between Mobile Client and Servoy Application Server (asynchronously),

calling


"successCallback"

on

successful

synchronisation,

with

first

argument

the

size

of

the

received

data

in

bytes,


or

"errorHandler"

if

an

error

occurs

during

synchronisation,

with

first

argument

the

HTTP

status

code

for

the

request

or

\

-1

if

unknown,

and

the

second

argument


the

error

message.

When

done,

this

call

might

(and

most

of

the

time

does)

need

to

move

to

first

form,

as

the

(new)

local

data

might

be

completely

different

\

-

invalidating

the

current

form/history.


As

callback

methods

are

set,

the

call

back

methods

will

be

responsible

for

doing

this

themselves

\

-

for

example

using

controller.show()

of

the

first

form.

{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Function]} successCallback -- Method to be called if the sync was successful. Can be null. \{[Function]} errorHandler -- Method to be called if an error occurs during synchronisation. Can be null. {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}

Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{Function} successCallback – Method to be called if the sync was successful. Can be null.
{Function} errorHandler – Method to be called if an error occurs during synchronisation. Can be null.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

function onSyncAction(event)
{
	plugins.mobile.syncData(onSyncSuccess, onSyncError);
}

function onSyncSuccess(dataBytes)
{	
	if (dataBytes > 0) forms.contacts.showContacts(accountmanager_to_companies.companies_to_contacts);
}
 
function onSyncError(http_status_code, error_message)
{
	plugins.dialogs.showWarningDialog("Warning", 'Sync failed with http status code: ' + http_status_code + ', and error message: ' + error_message);
}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}
Table Row (tr)
classlastDetailRow
Table Cell (td)