Pular para o conteúdo principal

Store

With this namespace, you can quickly provide methods to manipulate the data store.

The namespace Store provides to developers, methods to easily batch, delete, filter, get, insert, load, refresh and update data from the store.

//accessing to Store methods
SW.Store.{methodName}

batch

Description

This method can be used to insert, delete or update a data source in the store.

Method(s)

1   declare function batch(dataSourceName: string, data: IDashboardStoreBatchUpdate, senderId: any): Promise<any>;
ParameterTypeRequiredDefaultsDescription
dataSourceNamestringtrueData source name
dataIDashboardStoreBatchUpdatetrueOperation and data to be modified
senderIdanyfalseSender id

Basic Usage

SW.Store.batch('dataSourceName', {insert: ['newRow']});
SW.Store.batch('dataSourceName', {update: [{ row:{id: 'rowId', value: 'rowValue'}, data: 'rowData'}]});
SW.Store.batch('dataSourceName', {delete: [{id: 'rowId', value: 'rowValue'}]});

delete

Description

This method can be used to delete a row in a data source.

Method(s)

1   declare function delete(dataSourceName: string, rowId: IDashboardStoreRow, senderId): Promise<any>;
ParameterTypeRequiredDefaultsDescription
dataSourceNamestringtrueData source name
rowIdIDashboardStoreRowtrueRow to delete
senderIdanyfalseSender id

Basic Usage

SW.Store.delete('dataSourceName', {id: 'rowId', value: 'rowValue'});

filter

Description

This method can be used to filter a data source from the store.

Method(s)

1   declare function filter(filters: DashboardStoreFilters, senderId = ""): void;
ParameterTypeRequiredDefaultsDescription
filtersDashboardStoreFilterstrueFilters to apply
senderIdanyfalseSender id

Basic Usage

SW.Store.filter({'dataSourceName': [{id: 'rowsId' , value: 'rowsValue'}]});

get

Description

This method can be used to get a row in a data source.

Method(s)

1   declare function get(dataSourceName: string, rowId: IDashboardStoreRow, dashboardDefinitionId: string): Promise<any>;
ParameterTypeRequiredDefaultsDescription
dataSourceNamestringtrueData source name
rowIdIDashboardStoreRowfalseRow to get
dashboardDefinitionIdstringfalseWorkspace id

Basic Usage

SW.Store.get('dataSourceName', {id: 'rowId', value: 'rowValue'});

insert

Description

This method can be used to insert a row in a data source.

Method(s)

1   declare function insert(dataSourceName: string, rowData: any, senderId): Promise<any>;
ParameterTypeRequiredDefaultsDescription
dataSourceNamestringtrueData source name
rowDataanytrueNew row data
senderIdanyfalseSender id

Basic Usage

SW.Store.insert('dataSourceName', {'rowData'});

load

Description

This method can be used to load more than one data source.

Method(s)

1   declare function load(dataSourceNames?: string[], filters?: DashboardFilter[], senderId?: string): Promise<any>;
ParameterTypeRequiredDefaultsDescription
dataSourceNamestring[]falseData sources name
filtersDashboardFilter[]falseFilters to apply
senderIdstringfalseSender id

Basic Usage

SW.Store.load(['dataSourceName'], [{Name: 'FilterName', Value: 'FilterValue'}]);

refresh

Description

This method can be used to refresh a row from a data source.

Method(s)

1   declare function refresh(dataSourceName: string, rowId: { id: string; value: any }, senderId, filters): Promise<any>;
ParameterTypeRequiredDefaultsDescription
dataSourceNamestringtrueData source name
rowIdIDashboardStoreRowtrueRow to refresh
senderIdanyfalseSender id
filtersDashboardFilter[]falseFilters to be used in Data Source

Basic Usage

SW.Store.refresh('dataSourceName', {id: 'rowId', value: 'rowValue'}, senderId, [{Name: 'FilterName', Value: 'FilterValue'}]);

update

Description

This method can be used to update a row from a data source.

Method(s)

1   declare function update(dataSourceName: string, rowId: { id: string; value: any }, rowData: any, senderId): Promise<any>;
ParameterTypeRequiredDefaultsDescription
dataSourceNamestringtrueData source name
rowIdIDashboardStoreRowtrueRow to update
rowDataanytrueRow's new data
senderIdanyfalseSender id

Basic Usage

SW.Store.update('dataSourceName', {id: 'rowId', value: 'rowValue'}, {'newData'});