A simple selection manager
- keeps track of selected records for a specific view
- allow simple operations like add/delete/get/reset
- store in a localStorage object, which key is the viewId
- works in combination with datatables or other data components with selection capabilities
Methods
# static delete(viewId, recordId)
Delete a record from the view selection
Parameters:
Name | Type | Description |
---|---|---|
viewId |
string
|
|
recordId |
string
|
# static deleteSelectedRecords()
Delete the selected records
# static get(viewId) → {Array.<string>}
Get the current selection for a view
Parameters:
Name | Type | Description |
---|---|---|
viewId |
string
|
The list of ids of the selected records
Array.<string>
# static getFromActiveView(viewId) → {Array.<string>}
Get the current selection for the active view
Parameters:
Name | Type | Description |
---|---|---|
viewId |
string
|
The list of ids of the selected records
Array.<string>
# static getRecords(viewId) → {Array.<object>}
Get the selected records in a view
Parameters:
Name | Type | Description |
---|---|---|
viewId |
string
|
The list of selected records
Array.<object>
# static getRecordsFromActiveView() → {Array.<object>}
Get the selected records in the active view
The list of selected records
Array.<object>
# static insertMany(viewId, recordIds)
Insert many records into the view selection
Parameters:
Name | Type | Description |
---|---|---|
viewId |
string
|
|
recordIds |
Array.<string>
|
# static insertOne(viewId, recordId)
Insert one record into the view selection
Parameters:
Name | Type | Description |
---|---|---|
viewId |
string
|
|
recordId |
string
|
# static reset(viewId)
Reset the selection of a view
Parameters:
Name | Type | Description |
---|---|---|
viewId |
string
|
# static updateSelectedRecords()
Opens a window to batch update the selected records