Ajax

Simplicite. Ajax

new Ajax(approot, gateway, login, password, async)

Description:
  • Simplicité® application.

Example
// Using authenticated user thru UI gateway
var app = new Simplicite.Ajax("myapp");
// Using public user thru public UI gateway
var app = new Simplicite.Ajax("myapp", "uipublic");
// Using website user thru WS gateway
var app = new Simplicite.Ajax("myapp", "ws", "myuser", "mypassword");
// Using website user thru API gateway
var app = new Simplicite.Ajax("myapp", "api", "myuser", "mypassword");
Parameters:
Name Type Description
approot

Application root (either application name or /<context root> or absolute base URL)

gateway

Gateway type to use :

  • 1 or "ui": Authenticated UI gateway (default)
  • 2 or "uipublic" : Public UI gateway
  • 4 or "api" : API gateway
login

User's login (not required for UI gateways)

password

User's password (not required for UI gateways)

async

Asynchronous calls by default (true if absent) ?

Classes

BusinessObject
BusinessProcess
Grant
ObjectField
TreeView

Members

(constant) CONTEXT_ACTION :number

Description:
  • Action context.

Action context.

Type:
  • number

(constant) CONTEXT_AGENDA :number

Description:
  • Agenda context.

Agenda context.

Type:
  • number

(constant) CONTEXT_ASSOCIATE :number

Description:
  • Association context.

Association context.

Type:
  • number

(constant) CONTEXT_COPY :number

Description:
  • Copy context.

Copy context.

Type:
  • number

(constant) CONTEXT_CREATE :number

Description:
  • Creation context.

Creation context.

Type:
  • number

(constant) CONTEXT_CROSSTAB :number

Description:
  • Cross table context.

Cross table context.

Type:
  • number

(constant) CONTEXT_DATAMAPSELECT :number

Description:
  • Data mapping selection context.

Data mapping selection context.

Type:
  • number

(constant) CONTEXT_DELETE :number

Description:
  • Delete context.

Delete context.

Type:
  • number

(constant) CONTEXT_EXPORT :number

Description:
  • Export context.

Export context.

Type:
  • number

(constant) CONTEXT_IMPORT :number

Description:
  • Import context.

Import context.

Type:
  • number

(constant) CONTEXT_LIST :number

Description:
  • List context.

List context.

Type:
  • number

(constant) CONTEXT_NONE :number

Description:
  • No context.

No context.

Type:
  • number

(constant) CONTEXT_PANELLIST :number

Description:
  • Panel list context.

Panel list context.

Type:
  • number

(constant) CONTEXT_PLACEMAP :number

Description:
  • Place map context.

Place map context.

Type:
  • number

(constant) CONTEXT_POSTVALIDATE :number

Description:
  • Post validate context.

Post validate context.

Type:
  • number

(constant) CONTEXT_PREVALIDATE :number

Description:
  • Pre-validate context.

Pre-validate context.

Type:
  • number

(constant) CONTEXT_PRINTTMPL :number

Description:
  • Publication template context.

Publication template context.

Type:
  • number

(constant) CONTEXT_REFSELECT :number

Description:
  • Reference selection context.

Reference selection context.

Type:
  • number
Description:
  • Search context.

Search context.

Type:
  • number

(constant) CONTEXT_STATETRANSITION :number

Description:
  • State transition context.

State transition context.

Type:
  • number

(constant) CONTEXT_UPDATE :number

Description:
  • Update context.

Update context.

Type:
  • number

(constant) CONTEXT_UPDATEALL :number

Description:
  • Bulk update context.

Bulk update context.

Type:
  • number

(constant) DEFAULT_ROW_ID :string

Description:
  • Default row ID value (for creation).

Default row ID value (for creation).

Type:
  • string

(constant) ERRLEVEL_ERROR :number

Description:
  • Error error value

Error error value

Type:
  • number

(constant) ERRLEVEL_FATAL :number

Description:
  • Fatal error value

Fatal error value

Type:
  • number

(constant) ERRLEVEL_WARNING :number

Description:
  • Minor error value

Minor error value

Type:
  • number

(constant) FALSE :string

Description:
  • False value

False value

Type:
  • string

(constant) GATEWAY_API :string

Description:
  • API gateway

API gateway

Type:
  • string

(constant) GATEWAY_UI :string

Description:
  • UI gateway

UI gateway

Type:
  • string

(constant) GATEWAY_UI_PUBLIC :string

Description:
  • Public UI gateway

Public UI gateway

Type:
  • string

(constant) RENDERING_DEFAULT :string

Description:
  • Default rendering.

Default rendering.

Type:
  • string

(constant) RENDERING_HORIZCHECKBOX :string

Description:
  • Rendering horizontal checkbox(es).

Rendering horizontal checkbox(es).

Type:
  • string

(constant) RENDERING_HORIZRADIOBUTTON :string

Description:
  • Rendering horizontal radio button(s).

Rendering horizontal radio button(s).

Type:
  • string

(constant) RENDERING_SELECTBOX :string

Description:
  • Select box rendering (single or multiple select).

Select box rendering (single or multiple select).

Type:
  • string

(constant) RENDERING_VERTCHECKBOX :string

Description:
  • Rendering vertical checkbox(es).

Rendering vertical checkbox(es).

Type:
  • string

(constant) RENDERING_VERTRADIOBUTTON :string

Description:
  • Rendering vertical radio button(s).

Rendering vertical radio button(s).

Type:
  • string

(constant) SEARCH_MONO :number

Description:
  • Searchable.

Searchable.

Type:
  • number

(constant) SEARCH_MULTI_CHECK :number

Description:
  • Searchable using check boxes.

Searchable using check boxes.

Type:
  • number

(constant) SEARCH_MULTI_LIST :number

Description:
  • Searchable using list box.

Searchable using list box.

Type:
  • number

(constant) SEARCH_NONE :number

Description:
  • Not searchable.

Not searchable.

Type:
  • number

(constant) SEARCH_PERIOD :number

Description:
  • Searchable using period.

Searchable using period.

Type:
  • number

(constant) TRUE :string

Description:
  • True value

True value

Type:
  • string

(constant) TYPE_BIGDECIMAL :number

Description:
  • Big decimal type.

Big decimal type.

Type:
  • number

(constant) TYPE_BOOLEAN :number

Description:
  • Boolean type.

Boolean type.

Type:
  • number

(constant) TYPE_COLOR :number

Description:
  • Color type.

Color type.

Type:
  • number

(constant) TYPE_DATE :number

Description:
  • Date type.

Date type.

Type:
  • number

(constant) TYPE_DATETIME :number

Description:
  • Date and time type.

Date and time type.

Type:
  • number

(constant) TYPE_DOC :number

Description:
  • Document type

Document type

Type:
  • number

(constant) TYPE_EMAIL :number

Description:
  • Email type.

Email type.

Type:
  • number

(constant) TYPE_ENUM :number

Description:
  • Single enumerated (list of values) type.

Single enumerated (list of values) type.

Type:
  • number

(constant) TYPE_ENUM_MULTI :number

Description:
  • Multiple enumerated (list of values) type.

Multiple enumerated (list of values) type.

Type:
  • number

(constant) TYPE_EXTFILE :number

Description:
  • External file reference type.

External file reference type.

Type:
  • number

(constant) TYPE_FLOAT :number

Description:
  • Float type.

Float type.

Type:
  • number

(constant) TYPE_GEOCOORDS :number

Description:
  • Geo coordinates type.

Geo coordinates type.

Type:
  • number

(constant) TYPE_HTML :number

Description:
  • HTML content type.

HTML content type.

Type:
  • number

(constant) TYPE_ID :number

Description:
  • Internal ID (foreign key) type.

Internal ID (foreign key) type.

Type:
  • number

(constant) TYPE_IMAGE :number

Description:
  • Image type.

Image type.

Type:
  • number

(constant) TYPE_INT :number

Description:
  • Integer type.

Integer type.

Type:
  • number

(constant) TYPE_LONG_STRING :number

Description:
  • Long string (unlimited) type.

Long string (unlimited) type.

Type:
  • number

(constant) TYPE_NOTEPAD :number

Description:
  • Notepad (incremental long text) type.

Notepad (incremental long text) type.

Type:
  • number

(constant) TYPE_OBJECT :number

Description:
  • Object type.

Object type.

Type:
  • number

(constant) TYPE_PASSWORD :number

Description:
  • Password type.

Password type.

Type:
  • number

(constant) TYPE_PHONENUM :number

Description:
  • Phone number type.

Phone number type.

Type:
  • number

(constant) TYPE_REGEXP :number

Description:
  • Regular expression type.

Regular expression type.

Type:
  • number

(constant) TYPE_STRING :number

Description:
  • String type.

String type.

Type:
  • number

(constant) TYPE_TIME :number

Description:
  • Time type.

Time type.

Type:
  • number

(constant) TYPE_URL :number

Description:
  • URL type.

URL type.

Type:
  • number

(constant) UPD_ALWAYS :number

Description:
  • Updatable in lists and forms.

Updatable in lists and forms.

Type:
  • number

(constant) UPD_FORM_ONLY :number

Description:
  • Updatable in forms only.

Updatable in forms only.

Type:
  • number

(constant) UPD_LIST_ONLY :number

Description:
  • Updatable in lists only.

Updatable in lists only.

Type:
  • number

(constant) UPD_READ_ONLY :number

Description:
  • Not updatable.

Not updatable.

Type:
  • number

(constant) VIEW_TYPE :Object

Description:
  • View item types

View item types

Type:
  • Object

(constant) VIS_BOTH :number

Description:
  • Visible in lists and forms.

Visible in lists and forms.

Type:
  • number

(constant) VIS_FORBIDDEN :number

Description:
  • Forbidden on UI

Forbidden on UI

Type:
  • number

(constant) VIS_FORM :number

Description:
  • Visible in forms.

Visible in forms.

Type:
  • number

(constant) VIS_HIDDEN :number

Description:
  • Not visible.

Not visible.

Type:
  • number

(constant) VIS_LIST :number

Description:
  • Visible in lists.

Visible in lists.

Type:
  • number

(constant) VIS_NOT :number

Description:
  • Not visible (alias to VIS_HIDDEN).

Not visible (alias to VIS_HIDDEN).

Type:
  • number

appinfo

Description:
  • Application info data.

    • name: Application name
    • version: Application version
    • platformversion: Platform version
    • encoding: Encoding
    • server: Server vendor
    • Etc.

Application info data.

  • name: Application name
  • version: Application version
  • platformversion: Platform version
  • encoding: Encoding
  • server: Server vendor
  • Etc.

authToken

Description:
  • Server side session authentication token.

Server side session authentication token.

authTokenExpiryDate

Description:
  • Server side session authentication token expiry date

Server side session authentication token expiry date

grant

Description:
  • Grant data.

    • login: User login
    • firstname: User first name
    • lastname: User last name
    • responsibilities: User active responsibilites array
    • Etc.

Grant data.

  • login: User login
  • firstname: User first name
  • lastname: User last name
  • responsibilities: User active responsibilites array
  • Etc.
Description:
  • Menu data.

Menu data.

news

Description:
  • News array. Use news["<code>"] to get a news object)

News array. Use news["<code>"] to get a news object)

sessionId

Description:
  • Server side session identifier.

Server side session identifier.

sysparams

Description:
  • System parameters array. Use sysparams["<name>"] to get a system parameter value.

System parameters array. Use sysparams["<name>"] to get a system parameter value.

texts

Description:
  • Texts. Use texts["<code>"] to get a text value.

Texts. Use texts["<code>"] to get a text value.

views

Description:
  • View definitions

View definitions

Methods

T(code, plural) → {string}

Description:
  • Get text value (alias to getText).

Parameters:
Name Type Description
code string

Text code

plural boolean

True to get the plural value if known

Returns:

Text value

Type
string

base64Decode(s) → {string}

Description:
  • Decode a base64 string to string

Parameters:
Name Type Description
s string

Base64-encoded string

Returns:

Decoded string

Type
string

base64Encode(s) → {string}

Description:
  • Encode a string to base64

Parameters:
Name Type Description
s string

Input string

Returns:

Base64-encoded string

Type
string

base64EncodeArrayBuffer(b) → {string}

Description:
  • Encode an array buffer (such as got from a local file read) to to base64

Parameters:
Name Type Description
b Array

Array buffer

Returns:

Base64-encoded string

Type
string

changeLang(cbk, lang, params)

Description:
  • change user language

Parameters:
Name Type Description
cbk

Callback function called when completed

lang

language code (FRA, ENU...)

params

Optional parameters:

Properties
Name Type Description
pref boolean

Update also the preferred language

async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (use default error handler if absent)?

clearCache(obj)

Description:
  • Remove objects from cache

Parameters:
Name Type Description
obj

Object name or business object

contentURL(file)

Description:
  • Returns content URL.

Parameters:
Name Type Description
file string

Content file name

dataURL(doc, thumb)

Description:
  • Returns local data URL (e.g. suitable for src of img tags).

Parameters:
Name Type Description
doc

Document with mime type and base64 image or thumbnail

thumb

Return document thumbnail?

debug(msg)

Description:
  • Debug handler

Parameters:
Name Type Description
msg string

Message

dispositionResourceURL(code, type)

Description:
  • Returns disposition resource URL.

Parameters:
Name Type Description
code string

Resource code

type string

Resource type (IMG=image (default), ICO=Icon, CSS=stylesheet, JS=Javascript, HTML=HTML)

documentURL(object, field, rowId, docId, cdisp)

Description:
  • Returns document URL.

Parameters:
Name Type Description
object Object | string

Object name or object

Properties
Name Type Description
object string

Object name

field string

Field name

rowId string

Row ID

docId string

Document name

field string

Field name

rowId string

Object record row ID

docId string

Document ID (can be omitted then a lookup is done on record matching rowId)

cdisp string

Disposition: attachment or inline (defaults to inline)

editor(cbk, service, params, post)

Description:
  • Editor services

Parameters:
Name Type Description
cbk function

Optional callback with result

service string

prefs|open|close|save|completion|move|explore

params params

Optional parameters { object, inst, rowId, field, scope, type, cls, prefix, force, from, to, explore, javadoc, cls, pkg }

post Object

Optional post data with document

error(msg)

Description:
  • Error handler

Parameters:
Name Type Description
msg string

Message

firebase(callback, data, params)

Description:
  • Firebase service to send mobile notification

Parameters:
Name Type Description
callback function

Optional callback

data Object

Parameters

Properties
Name Type Description
title string

Optional title

message string

Message body

to Object

{users, groups} list of logins or groups, or 'all' to notify all users

token string

Optional refresh device token

oldtoken string

Optional previous token to remove

params Object

parameters:

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (use default error handler if absent)?

follow(callback, params)

Description:
  • Social follow service.

Parameters:
Name Type Description
callback function

Callback function({followed, followers} | {author})

params Object

parameters:

  • async Asynchronous call (use default if absent) ?
  • error Custom error handler (use default error handler if absent) ?
  • method follow|unfollow|accept|deny|search
  • param related userId or search request
  • object optional User object to use
  • all optional to search all authors or not

getAppInfo(callback, params)

Description:
  • Loads application info data.

Parameters:
Name Type Description
callback

Callback function called when loading is completed (loaded application info data is passed to this function)

params

Optional parameters:

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (use default error handler if absent)?

getAsync() → {boolean}

Description:
  • Is globally asynchronous?

Returns:

True if is globally asynchronous

Type
boolean

getBusinessObject(obj, objInstName)

Description:
  • Get a new business object.

Example
// app is a Simplicite.Ajax instance
var obj = app.getBusinessObject("MyObject");
// other instance of obj
var tmp = app.getBusinessObject(obj, "tmpObj");
Parameters:
Name Type Description
obj

Object name or business object

objInstName

Optional instance name (default the_ajax_<object name>)

getBusinessProcess(name)

Description:
  • Get a new business process.

Example
// app is a Simplicite.Ajax instance
var pcs = app.getBusinessProcess("MyProcess");
Parameters:
Name Type Description
name

Business process name

getExternalObject(callback, name, params)

Description:
  • Loads external object definition.

Parameters:
Name Type Description
callback fucntion

Callback function called when loading is completed (loaded external object is passed to this function)

name string

External object name

params Object

Optional parameters:

  • async Asynchronous call (use default if absent) ?
  • error Custom error handler (use default error handler if absent) ?

getExternalObjectURL(name, params, embedded)

Description:
  • External object URL.

Parameters:
Name Type Description
name string

Object name

params Object

Optional parameters (object or string)

embedded boolean

True to get a relative URL, false to get the full http URL (loadURL will create an iframe)

getGateway() → {string}

Description:
  • Get gateway

Returns:

Gateway (one of GATEWAY_* constants)

Type
string

getGrant(callback, params)

Description:
  • Loads grant data.

Parameters:
Name Type Description
callback

Callback function called when loading is completed (loaded grant data is passed to this function)

params

Optional parameters:

  • inlinePicture Inline picture (false if absent or undefined)
  • async Asynchronous call (use default if absent) ?
  • error Custom error handler (use default error handler if absent) ?
  • web true to load menu texts sysparams

getIconURL(name)

Description:
  • Icon URL

Parameters:
Name Type Description
name string

Resource icon name

getMenu(callback, params)

Description:
  • Loads menu data.

Parameters:
Name Type Description
callback

Callback function called when loading is completed (loaded menu data is passed to this function)

params

Optional parameters:

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (use default error handler if absent)?

getNews(callback, params)

Description:
  • Loads news.

Parameters:
Name Type Description
callback function

Callback function called when loading is completed (loaded news array is passed to this function)

params Object

Optional parameters:

  • count Return news count only (false if absent or undefined)
  • inlineImages Inline news images (false if absent or undefined, not taken into account if count is true)
  • async Asynchronous call (use default if absent) ?
  • error Custom error handler (use default error handler if absent) ?

getResourceURL(code, type, object, objId)

Description:
  • Returns Object resource URL.

Parameters:
Name Type Description
code string

Resource code

type string

Resource type (IMG=image (default), ICO=Icon, CSS=stylesheet, JS=Javascript, HTML=HTML)

object string

Object name: ObjectInternal or ObjectExternal (for Disposition use dispositionResourceURL)

objId string

Object row ID (not the resource row ID)

getSysInfo(callback, params)

Description:
  • Loads system info data.

Parameters:
Name Type Description
callback

Callback function called when loading is completed (loaded system info data is passed to this function)

params

Optional parameters:

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (use default error handler if absent)?

getSysParam(cbk, name, params)

Description:
  • Get system parameter value.

Parameters:
Name Type Description
cbk

optional callback(value)

name

System parameter name

params

Optional parameters:

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (use default error handler if absent)?

force boolean

Force read system parameter value from the database?

getSysParams(callback, params)

Description:
  • Loads system parameters.

Parameters:
Name Type Description
callback

Callback function called when loading is completed (loaded system parameters array is passed to this function)

params

Optional parameters:

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (use default error handler if absent)?

getText(code, plural) → {string}

Description:
  • Get text value.

Parameters:
Name Type Description
code string

Text code

plural boolean

True to get the plural value if known

Returns:

Text value

Type
string

getTexts(callback, params)

Description:
  • Loads texts.

Parameters:
Name Type Description
callback

Callback function called when loading is completed (loaded texts array is passed to this function)

params

Optional parameters:

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (use default error handler if absent)?

getTimeout() → {string}

Description:
  • Get timeout

Returns:

Timeout

Type
string

getUserInfo(callback, login, params)

Description:
  • Loads basic user data (login, name, email, picture).

Parameters:
Name Type Description
callback

Callback function called when loading is completed (loaded user data is passed to this function)

login

User login

params

Optional parameters:

  • inlinePicture Inline picture (false if absent or undefined)
  • async Asynchronous call (use default if absent) ?
  • error Custom error handler (use default error handler if absent) ?

getView(callback, name, params)

Description:
  • Loads view definition.

Parameters:
Name Type Description
callback

Callback function called when loading is completed (loaded view is passed to this function)

name

View name

params

Optional parameters:

  • home optional for home or panel instance (default true to get home object instances)
  • async Asynchronous call (use default if absent) ?
  • error Custom error handler (use default error handler if absent) ?

imageURL(object, field, rowId, docId, thumb)

Description:
  • Returns image URL.

Parameters:
Name Type Description
object string

Object name

field string

Field name

rowId string

Object record row ID

docId string

Document ID

thumb boolean

Return thumbnail image

indexsearch(callback, request, params)

Description:
  • Search from index.

Parameters:
Name Type Description
callback function

Callback function with result list

request string

Index search request string

  • simple text with wildcards and operators
  • in:domain:xxx[:all] = to get recent objects in a specific domain 'xxx', 'all' or by default those updated by the user
  • in:docs:obj1[;obj2;obj3...] text = to search the text in joined documents of listed objects
params Object

Optional parameters

  • inlineDocs Inline documents (false if absent or undefined, can be a boolean or an array of document fields to inline) ?
  • inlineThumbs Inline image documents thumbnails (false if absent or undefined) ?
  • inlineObjs Inline objects fields items (false if absent or undefined, can be a boolean or an array of object fields to inline) ?
  • async Asynchronous call (use default if absent) ?
  • error Custom error handler (use default error handler if absent) ?
  • metadata: gets the search engine metadata { indexed:[{name,label},...], withDocs:[{name,label},...] }
  • useFilter: apply user preference INDEX_OBJ_FILTER to limit search

info(msg)

Description:
  • Info handler

Parameters:
Name Type Description
msg string

Message

isFalse(value) → {boolean}

Description:
  • Returns true if value is 0|false|no|n

Parameters:
Name Type Description
value string

parameter value

Returns:

Is value false?

Type
boolean

isFirefox()

Description:
  • Is Firefox?

Returns:

True if is Firefox

isTrue(value) → {boolean}

Description:
  • Returns true if value is 1|true|yes|y

Parameters:
Name Type Description
value string

parameter value

Returns:

Is value true?

Type
boolean

isWebkit()

Description:
  • Is WebKit?

Returns:

True if is WebKit

isWinIE()

Description:
  • Is Windows Internet Explorer?

Returns:

True if is Windows Internet Explorer

login(successCallback, failureCallback, authToken, params)

Description:
  • Login (same as session()).

Parameters:
Name Type Description
successCallback function

Callback function called when login is sucessful

failureCallback function

Callback function called when login fails

authToken string

Authentication token to (re)use (in case of a persistent token)

params Object

Optional parameters:

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

logout(successCallback, failureCallback, params)

Description:
  • Logout (in case of a persistent token it is deleted)

Parameters:
Name Type Description
successCallback function

Callback function called when login is sucessful

failureCallback function

Callback function called when login fails

params Object

Optional parameters:

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

messageToJson(msg)

Description:
  • Convert a textual backend message to json { code, text, level, field, label, error } or technical statement { redirect } or { javascript }

    • code: message code
    • text: optional contextual details
    • level: 'I'nfo, 'W'arning, 'E'rror, 'F'atal
    • field: optional field name of message
    • label: default text to display in user language
    • error: true when level is fatal or error
Parameters:
Name Type Description
msg

formatted backend message 'code:text#level#field#param:value' or 'redirect:url' or 'javascript:code'

module(callback, params)

Description:
  • Module services

Parameters:
Name Type Description
callback function

Callback

params Object

parameters:

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (use default error handler if absent)?

row_id string

Module row ID

del string

Deletion action start|status

confirm boolean

Confirm deletion?

monitor(m, params, cbk)

Description:
  • Monitoring service

Parameters:
Name Type Description
m string | Object

Monitoring service or plain JSON object to store

params Object

Optional parameters { session }

cbk function

Optional callback for response

onExpiredSession(callback, reason, callbackopt)

Description:
  • Handler when session has expired on server side, by default throws HTTP 401 in console. It can be overridden to return on the logon form in a UI context.

Parameters:
Name Type Attributes Description
callback

optional callback to call if session can be restored silently

reason Object

Expired reason

callback function <optional>

Callback to call if session can be restored silently

parseDateTimeValue(v) → {Date}

Description:
  • Parse a date time value into a Javascript Date

Parameters:
Name Type Description
v string

Date time value (YYYY-MM-DD HH:mm:ss)

Returns:

Javascript date

Type
Date

parseDateValue(v) → {Date}

Description:
  • Parse a date value into a Javascript Date

Parameters:
Name Type Description
v string

Date value (YYYY-MM-DD)

Returns:

Javascript date

Type
Date

resourceURL(resId)

Description:
  • Returns resource URL.

Parameters:
Name Type Description
resId string

Resource ID (e.g. taken from business object or external object resources list in metadata)

session(successCallback, failureCallback, authToken, params)

Description:
  • Session init (retrieves server side session identifier and auth token).

Parameters:
Name Type Description
successCallback function

Callback function called when session init is sucessful

failureCallback function

Callback function called when session init fails

authToken string

Auth token to (re)use (in case of persistent tokens)

params Object

Optional parameters:

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

scope string

Optional session scope

clientId string

Optional client Id

setAsync(async)

Description:
  • Set globallty asynchronous (is globally asynchronous by default)

Parameters:
Name Type Description
async boolean

Asynchronous?

setDebugHandler(debugHandler)

Description:
  • Change default global debug handler.

Parameters:
Name Type Description
debugHandler

Debug handler function

setDebugHandlerActive(active)

Description:
  • Set default global debug handler active or inactive.

Parameters:
Name Type Description
active

Active status

setErrorHandler(errorHandler)

Description:
  • Change default global error handler.

Parameters:
Name Type Description
errorHandler

Error handler function

setErrorHandlerActive(active)

Description:
  • Set default global error handler active or inactive.

Parameters:
Name Type Description
active

Active status

setGateway(gateway, loginopt, passwordopt)

Description:
  • Set gateway and credentials

Parameters:
Name Type Attributes Description
gateway string

Gateway (one of GATEWAY_* constants)

login string <optional>

Login

password string <optional>

Password

setInfoHandler(infoHandler)

Description:
  • Change default global information handler.

Parameters:
Name Type Description
infoHandler

Information handler function

setInfoHandlerActive(active)

Description:
  • Set default global information handler active or inactive.

Parameters:
Name Type Description
active

Active status

setPassword(callback, password, params)

Description:
  • Set password.

Parameters:
Name Type Description
callback

Callback function called when loading is completed

password

Password

params

Optional parameters:

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (use default error handler if absent)?

setSysParam(callback, name, value, save, params)

Description:
  • Set a user system parameter.

Parameters:
Name Type Description
callback

Callback function called when loading is completed (parameter is passed to this function)

name

Parameter name

value

Parameter value (if undefined parameter is unset)

save

Save parameter in user parameters (if undefined parameter is not saved)

params

Optional parameters :

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (use default error handler if absent)?

setTimeout(timeout)

Description:
  • Set timeout

Parameters:
Name Type Description
timeout number

Timeout (seconds)

setWarningHandler(warningHandler)

Description:
  • Change default global warning handler.

Parameters:
Name Type Description
warningHandler

Warning handler function

setWarningHandlerActive(active)

Description:
  • Set default global warning handler active or inactive.

Parameters:
Name Type Description
active

Active status

social(callback, post, params)

Description:
  • Social post service.

Parameters:
Name Type Description
callback function

Callback function({count, posted, page, list, follow})

post Object

optional post to save or delete { id, userId, message, pub, object, rowId }

params Object

Optional parameters:

  • async Asynchronous call (use default if absent) ?
  • error Custom error handler (use default error handler if absent) ?
  • counters true to get counters without posts
  • object Optional object name
  • rowId Optional row ID
  • page Optional page to search, -1=no search
  • activity true to include activity message
  • level optional level filter
  • audit to list audit message only
  • del true to delete the post (default the service upsert the post)
  • like Optional true to like, false to unlike
  • status Optional status to update
  • follow true to get follow counters

syntax(callback, data, params)

Description:
  • Syntax service: will return an object with the results

Parameters:
Name Type Description
callback function

function(response)

data Object

parameters

Properties
Name Type Description
type string

type of syntax service: field

objectid string

object id for field name

value Object

value to validate or transform

params Object

parameters:

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (use default error handler if absent)?

toDateTimeValue(d) → {string}

Description:
  • Parse a Javascript Date into a date time value

Parameters:
Name Type Description
d Date

Javascript date

Returns:

Date time value (YYYY-MM-DD HH-mm-ss)

Type
string

toDateValue(d) → {string}

Description:
  • Parse a Javascript Date into a date value

Parameters:
Name Type Description
d Date

Javascript date

Returns:

Date value (YYYY-MM-DD)

Type
string

toTimeValue(d) → {string}

Description:
  • Parse a Javascript Date into a time value

Parameters:
Name Type Description
d Date

Javascript date

Returns:

Time value (HH:mm:ss)

Type
string

treeview(callback, name, params)

Description:
  • Treeview services

Parameters:
Name Type Description
callback

Callback function called when loading is completed (loaded view is passed to this function)

name

Treeview name

params

Optional parameters:

  • service: metadata (default), page, getmenu, addmenu, delmenu
  • object: optional object name
  • rowid: optional object rowId
  • child: child object for page service
  • page: page number for page service
  • async Asynchronous call (use default if absent) ?
  • error Custom error handler (use default error handler if absent) ?

warning(msg)

Description:
  • Warning handler

Parameters:
Name Type Description
msg string

Message

winIEVersion() → {number}

Description:
  • Get Windows Internet Explorer version

Returns:

Version

Type
number