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>;
Parameter | Type | Required | Defaults | Description |
---|---|---|---|---|
dataSourceName | string | true | Data source name | |
data | IDashboardStoreBatchUpdate | true | Operation and data to be modified | |
senderId | any | false | Sender 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>;
Parameter | Type | Required | Defaults | Description |
---|---|---|---|---|
dataSourceName | string | true | Data source name | |
rowId | IDashboardStoreRow | true | Row to delete | |
senderId | any | false | Sender 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;
Parameter | Type | Required | Defaults | Description |
---|---|---|---|---|
filters | DashboardStoreFilters | true | Filters to apply | |
senderId | any | false | Sender 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>;
Parameter | Type | Required | Defaults | Description |
---|---|---|---|---|
dataSourceName | string | true | Data source name | |
rowId | IDashboardStoreRow | false | Row to get | |
dashboardDefinitionId | string | false | Workspace 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>;
Parameter | Type | Required | Defaults | Description |
---|---|---|---|---|
dataSourceName | string | true | Data source name | |
rowData | any | true | New row data | |
senderId | any | false | Sender 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>;
Parameter | Type | Required | Defaults | Description |
---|---|---|---|---|
dataSourceName | string[] | false | Data sources name | |
filters | DashboardFilter[] | false | Filters to apply | |
senderId | string | false | Sender 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>;
Parameter | Type | Required | Defaults | Description |
---|---|---|---|---|
dataSourceName | string | true | Data source name | |
rowId | IDashboardStoreRow | true | Row to refresh | |
senderId | any | false | Sender id | |
filters | DashboardFilter[] | false | Filters 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>;
Parameter | Type | Required | Defaults | Description |
---|---|---|---|---|
dataSourceName | string | true | Data source name | |
rowId | IDashboardStoreRow | true | Row to update | |
rowData | any | true | Row's new data | |
senderId | any | false | Sender id |
Basic Usage
SW.Store.update('dataSourceName', {id: 'rowId', value: 'rowValue'}, {'newData'});