DataSource

DataSource

new DataSource()

Description:
  • DataSource Object

Source:

Extends

Members

(readonly) attributes

Description:
  • Returns the object attributes

Source:
Inherited From:

Returns the object attributes

(readonly) container

Description:
  • The swat object top-level parent, usually a window or dialog object

Source:
Inherited From:

The swat object top-level parent, usually a window or dialog object

(readonly) controller :*

Description:
  • The object's legacy API controller. Used for JavaScript calls from TypeScript.

Source:
Inherited From:

The object's legacy API controller. Used for JavaScript calls from TypeScript.

Type:
  • *
Example
window.akioma.myFunction(eventSource.controller);

(readonly) dynObject :*

Description:
  • The object's legacy API dynObject. Used for JavaScript calls from TypeScript.

Source:
Inherited From:

The object's legacy API dynObject. Used for JavaScript calls from TypeScript.

Type:
  • *
Example
window.akioma.myFunction(eventSource.dynObject);

(readonly) hasMessages :boolean

Description:
  • Returns if there are messages from the previous save

Source:

Returns if there are messages from the previous save

Type:
  • boolean

(readonly) name :string

Description:
  • The object name

Source:
Inherited From:

The object name

Type:
  • string

(readonly) parent :SwatObject

Description:
  • The swat object direct parent

Source:
Inherited From:

The swat object direct parent

Type:

refreshSchemePayload

Description:
  • Method used for getting the refresh scheme payload

Source:

Method used for getting the refresh scheme payload

(readonly) screen

Description:
  • The swat object inner screen (container)

Source:
Inherited From:

The swat object inner screen (container)

(readonly) topScreen

Description:
  • The swat object top screen (container), usually a window or dialog object

Source:
Inherited From:

The swat object top screen (container), usually a window or dialog object

type :string

Description:
  • Used for retriving the object type

Source:
Inherited From:

Used for retriving the object type

Type:
  • string

(readonly) window :Window

Description:
  • The swat object top-level window object. Note: Desktop windows are windows not frames so the window property of a child object in a desktop window will return the desktop window unlike the container property which will return the main desktop window for the application. Note: If the object is a window then it will returns itself.

Source:
Inherited From:

The swat object top-level window object. Note: Desktop windows are windows not frames so the window property of a child object in a desktop window will return the desktop window unlike the container property which will return the main desktop window for the application. Note: If the object is a window then it will returns itself.

Type:

Methods

addFilter(name, operator, value, unique)

Description:
  • Add filter (top level AND filter)

Source:
Parameters:
Name Type Description
name string

The field name (case-insensitive)

operator string

The filter operator

value string

The filter value

unique boolean

If true, adds a new unique condition that will overwrite any conditions with the same field name. If false, just adds a new condition

addRecord()

Description:
  • Adds a new empty record

Source:

clearFilter()

Description:
  • Clears all filters

Source:

clearSort()

Description:
  • Clears sorting

Source:

closeQuery()

Description:
  • Closes the query and empties the records

Source:

deleteRecord(options) → {Promise.<void>}

Description:
  • Deletes the current record

Source:
Parameters:
Name Type Description
options object

Delete options

Properties
Name Type Attributes Default Description
closeWindow boolean <optional>
true

Closes the container window after delete. Defaults to true.

Returns:
Type
Promise.<void>

fetch() → {Promise.<unknown>}

Source:
Parameters:
Name Type Description
opts.repositionTo string

The handle used to position a record in Grid. Can be a comma-separated list of handles when using a multiselect Grid.

Returns:

Returns a promise with the reponse

Type
Promise.<unknown>

getBeforeData() → {*}

Description:
  • Returns the current record data before changes

Source:
Returns:
Type
*

getCurrentRecord() → {*}

Description:
  • Gets the current record with all the record values

Source:
Returns:

Returns the current record

Type
*

getData() → {Object}

Description:
  • Gets all the locally stored data.

Source:
Returns:

Returns an object containing the locally stored data

Type
Object

getFilter(name) → {Array.<Object>|null}

Description:
  • Returns the filter conditions from a given field name. (top level AND filter)

Source:
Parameters:
Name Type Description
name string

The field name (case-insensitive)

Returns:
Type
Array.<Object> | null
Description:
  • Gets the object's link source or target object

Source:
Inherited From:
Example
myForm.getLink("DISPLAY:SRC")
Parameters:
Name Type Description
link string

The link name separated by ":" and SRC/TRG points e.g. "DATA:TRG"

Returns:
Type
SwatObject
Description:
  • Gets the object's link source or target objects

Source:
Inherited From:
Example
myDataSource.getLinks("DISPLAY:TRG")
Parameters:
Name Type Description
link string

The link name separated by ":" and SRC/TRG points e.g. "DATA:TRG"

Returns:

[]

Type
SwatObject

getLoadedRecords() → {*}

Description:
  • Gets all the loaded records

Source:
Returns:

Returns an array with all the loaded records

Type
*

getObject(name) → {SwatObject}

Description:
  • Gets a descendant object by name

Source:
Inherited From:
Parameters:
Name Type Description
name string

The object name (case-insensitive)

Returns:
Type
SwatObject

getSort()

Description:
  • Returns the current sorting

Source:

getUpdatedRecords() → {*}

Description:
  • Gets all the updated records

Source:
Returns:

Returns an array with all the updated records

Type
*

getValue(name) → {*}

Description:
  • Gets the data object field value

Source:
Parameters:
Name Type Description
name string

The field name (case-insensitive)

Returns:
Type
*

hasChanges() → {boolean}

Description:
  • Returns if there are changes, recusive hasChanges check

Source:
Returns:
Type
boolean

hasFilter(name, operator, value) → {boolean}

Description:
  • Check if specific filter exists (top level AND filter)

Source:
Parameters:
Name Type Description
name string

The field name (case-insensitive)

operator string

The filter operator

value string

The filter value

Returns:
Type
boolean

hasFilters(name) → {boolean}

Description:
  • Check if there are any filters for a field (top level AND filter)

Source:
Parameters:
Name Type Description
name string

The field name (case-insensitive)

Returns:
Type
boolean

hasSort(name, direction)

Description:
  • Checks if a field (and optional direction) are in the datasource sorting. Returns true if the field exists at any level not just the first level.

Source:
Parameters:
Name Type Description
name

The field name (case-insensitive). If no field name is passed, checks if there is any sorting.

direction

"asc" for ascending or "desc" for descending. If no direction is passed, check if only field name exists.

openQuery(callback)

Description:
  • Deprecated method to execute the query

Source:
Deprecated:
  • Use fetch() instead
Parameters:
Name Type Description
opts.repositionTo string

The handle used to position a record in Grid. Can be a comma-separated list of handles when using a multiselect Grid.

callback function

The callback function to be called at the AfterFill event.

removeFilter(name, operator, value)

Description:
  • Removes an existing filter condition (top level AND filter)

Source:
Parameters:
Name Type Description
name string

The field name (case-insensitive)

operator string

The filter operator

value string

The filter value

saveRecord() → {Promise.<void>}

Description:
  • Saves current record

Source:
Returns:
Type
Promise.<void>

setApplyQueryFilters(bApply)

Description:
  • Sets the businessEntity to perform queries that include both filters and NamedQuery params

Source:
Parameters:
Name Type Description
bApply boolean

The parameter that sets the apply all filters flag

setFilter(name, operator, value, uniqueopt)

Description:
  • Sets a filter (top level AND filter)

Source:
Parameters:
Name Type Attributes Description
name string

The field name (case-insensitive)

operator string

The filter operator

value string

The filter value

unique boolean <optional>

If true, adds a new unique condition that will overwrite any conditions with the same field name. If false, just adds a new condition

setForeignKeys(keys) → {void}

Description:
  • Method used for setting the foreign key fields for the dataSource, that will be sent as request payload in GetInitialValues call

Source:
Parameters:
Name Type Description
keys array

The list of foreign key fields with values

Returns:
Type
void

setNamedQueryParam(query, name, value, type)

Description:
  • Sets a named query parameter

Source:
Parameters:
Name Type Description
query string

The parameter query name

name string

The parameter field name

value *

The parameter value

type string

The parameter type

setSort(sortopt)

Description:
  • Sets the sorting

Source:
Parameters:
Name Type Attributes Description
sort array <optional>
Properties
Name Type Description
field string

The field name (case-insensitive)

direction string

"asc" for ascending or "desc" for descending

setValue(name, value, primaryKey) → {*}

Description:
  • Sets the data object field value

Source:
Parameters:
Name Type Description
name string

The field name (case-insensitive)

value value

The value of the field

primaryKey any

The value corresponding to the KeyField attribute; used to uniquely identify the record for which to set the new value; optional

Returns:
Type
*