DataManager

Provides data management capabilities for local and remote data sources. Supports CRUD operations, query execution, and data transformation through adaptors. Commonly used with components that require structured data handling, such as grids, lists, and more.

Methods

The following table outlines the methods for the DataManager:

NameParametersReturnsDescription
executeLocal
  • query?

    : Query
  • Object[]

    Executes the specified query against the local data source. If no query is provided, the default query is used. Throws an error if neither is available.


    Params:
  • query: Defines the query used to retrieve data from the local source.
  • executeQuery
  • query

    : Query | Function
  • done?

    : Function
  • fail?

    : Function
  • always?

    : Function
  • Promise<Response>

    Executes the specified query against either a local or remote data source. The operation is asynchronous and returns a Promise that resolves or rejects once the action is completed. If a function is passed instead of a query, it is treated as the done callback.


    Params:
  • query: Defines the query used to retrieve data, or a callback function.
  • done: Specifies the callback function triggered when the Promise is resolved.
  • fail: Specifies the callback function triggered when the Promise is rejected.
  • always: Specifies the callback function triggered when the Promise is either resolved or rejected.
  • insert
    -
    Object | Promise<Object>

    Inserts a new record into the specified table or data source. If tableName is a Query instance, it will be treated as the query and the table name will be ignored. The method supports both offline and remote data operations based on the DataManager configuration.

    remove
    -
    Object | Promise<Object>

    Removes a record from the data source using the specified key field and value. If the data source is remote, the removal is performed via a fetch request. If tableName is a Query instance, it is treated as the query and the table name is ignored.

    saveChanges
    -
    Promise<Object> | Object

    Saves multiple changes—such as additions, updates, and deletions—to the specified data source. When the data source is remote, all changes are submitted in a single request. If tableName is a Query instance, it is treated as the query and the table name is ignored.

    update
    -
    Object | Promise<Object>

    Updates an existing record in the specified data source. If tableName is a Query instance, it is treated as the query and the table name is ignored. When caching is enabled, the query key is generated for cache tracking.