Search results

DataManager API in JavaScript DataManager API control

DataManager is used to manage and manipulate relational data.

Methods

executeLocal

Executes the given query with local data source.

Parameter Type Description
query (optional) Query Defines the query to retrieve data.

Returns Object[]

executeQuery

Executes the given query with either local or remote data source. It will be executed as asynchronously and returns Promise object which will be resolved or rejected after action completed.

Parameter Type Description
query Query | Function Defines the query to retrieve data.
done (optional) Function Defines the callback function and triggers when the Promise is resolved.
fail (optional) Function Defines the callback function and triggers when the Promise is rejected.
always (optional) Function Defines the callback function and triggers when the Promise is resolved or rejected.

Returns Promise

getPersistedData

Get the queries maintained in the persisted state.

Parameter Type Description
id (optional) string The identifier of the persisted query to retrieve.

Returns object

insert

Inserts new record in the given table.

Parameter Type Description
data Object Defines the data to insert.
tableName (optional) string | Query Defines the table name.
query (optional) Query Sets default query for the DataManager.
position (optional) number

Returns Object | Promise

remove

Removes data from the table with the given key.

Parameter Type Description
keyField string Defines the column field.
value Object Defines the value to find the data in the specified column.
tableName (optional) string | Query Defines the table name
query (optional) Query Sets default query for the DataManager.

Returns Object | Promise

saveChanges

Save bulk changes to the given table name. User can add a new record, edit an existing record, and delete a record at the same time. If the datasource from remote, then updated in a single post.

Parameter Type Description
changes Object Defines the CrudOptions.
key (optional) string Defines the column field.
tableName (optional) string | Query Defines the table name.
query (optional) Query Sets default query for the DataManager.
original (optional) Object

Returns Promise | Object

setDefaultQuery

Overrides DataManager’s default query with given query.

Parameter Type Description
query Query Defines the new default query.

Returns DataManager

setPersistData

Set the queries to be maintained in the persisted state.

Parameter Type Description
e Event The event parameter that triggers the setPersistData method.
id (optional) string The identifier of the persisted query to set.
persistData (optional) object The data to be persisted.

Returns void

update

Updates existing record in the given table.

Parameter Type Description
keyField string Defines the column field.
value Object Defines the value to find the data in the specified column.
tableName (optional) string | Query Defines the table name
query (optional) Query Sets default query for the DataManager.
original (optional) Object

Returns Object | Promise