@serenity-is/corelib / RemoteView
Class: RemoteView<TItem>
Defined in: src/slick/remoteview.ts:82
A data view that supports remote data loading, sorting, filtering, grouping, and paging. Extends the functionality of SleekGrid's DataView with server-side data operations.
Type Parameters
TItem
TItem = any
Implements
IRemoteView<TItem>
Constructors
Constructor
new RemoteView<
TItem>(options):RemoteView<TItem>
Defined in: src/slick/remoteview.ts:158
Creates a new RemoteView.
Parameters
options
RemoteViewOptions<TItem>
Configuration options for the view.
Returns
RemoteView<TItem>
Properties
onAjaxCall
onAjaxCall:
RemoteViewAjaxCallback<TItem>
Defined in: src/slick/remoteview.ts:128
Callback invoked before AJAX calls are made.
Implementation of
onDataChanged
readonlyonDataChanged:EventEmitter<ArgsRemoteView, { }>
Defined in: src/slick/remoteview.ts:134
Event fired when the underlying data changes.
Implementation of
onDataLoaded
readonlyonDataLoaded:EventEmitter<ArgsRemoteView, { }>
Defined in: src/slick/remoteview.ts:136
Event fired when data loading completes.
Implementation of
onDataLoading
readonlyonDataLoading:EventEmitter<ArgsRemoteView, { }>
Defined in: src/slick/remoteview.ts:138
Event fired when data loading begins.
Implementation of
onGroupCollapsed
readonlyonGroupCollapsed:EventEmitter<ArgsGroupToggle, { }>
Defined in: src/slick/remoteview.ts:140
Event fired when a group is collapsed.
Implementation of
onGroupExpanded
readonlyonGroupExpanded:EventEmitter<ArgsGroupToggle, { }>
Defined in: src/slick/remoteview.ts:142
Event fired when a group is expanded.
Implementation of
onPagingInfoChanged
readonlyonPagingInfoChanged:EventEmitter<ArgsPagingInfo, { }>
Defined in: src/slick/remoteview.ts:144
Event fired when paging information changes.
Implementation of
IRemoteView.onPagingInfoChanged
onProcessData
onProcessData:
RemoteViewProcessCallback<TItem>
Defined in: src/slick/remoteview.ts:130
Callback invoked to process data received from the server.
Implementation of
onRecalcRows
readonlyonRecalcRows:EventEmitter<ArgsRecalcRows, { }>
Defined in: src/slick/remoteview.ts:146
Event fired when rows need to be recalculated.
Implementation of
onRowCountChanged
readonlyonRowCountChanged:EventEmitter<ArgsRowCountChanged, { }>
Defined in: src/slick/remoteview.ts:148
Event fired when the row count changes.
Implementation of
onRowsChanged
readonlyonRowsChanged:EventEmitter<ArgsRowsChanged, { }>
Defined in: src/slick/remoteview.ts:150
Event fired when row indices change.
Implementation of
onRowsOrCountChanged
readonlyonRowsOrCountChanged:EventEmitter<ArgsRowsOrCountChanged, { }>
Defined in: src/slick/remoteview.ts:152
Event fired when rows or row count change.
Implementation of
IRemoteView.onRowsOrCountChanged
onSubmit
onSubmit:
CancellableViewCallback<TItem>
Defined in: src/slick/remoteview.ts:132
Callback invoked before submitting a request; return false to cancel.
Implementation of
params
params:
Record<string,any>
Defined in: src/slick/remoteview.ts:119
Additional parameters to send with service requests.
Implementation of
seekToPage
seekToPage:
number
Defined in: src/slick/remoteview.ts:121
The page number to seek to when loading data.
Implementation of
sortBy
sortBy:
string[]
Defined in: src/slick/remoteview.ts:123
Sort expressions for the data (e.g. "Name" or "Name desc").
Implementation of
url
url:
string
Defined in: src/slick/remoteview.ts:125
The URL of the service endpoint for data requests.
Implementation of
groupingInfoDefaults
readonlystaticgroupingInfoDefaults:GroupInfo<any>
Defined in: src/slick/remoteview.ts:184
Default configuration for grouping information
Accessors
idField
Get Signature
get idField():
string
Defined in: src/slick/remoteview.ts:1495
Deprecated
Gets the ID property name, for compatibility.
Returns
string
The ID property name.
Methods
addData()
addData(
data):boolean
Defined in: src/slick/remoteview.ts:1320
Adds data received from the server to the view.
Parameters
data
any
The response data from the server.
Returns
boolean
False if the data could not be added.
Implementation of
addItem()
addItem(
item):void
Defined in: src/slick/remoteview.ts:667
Adds an item to the end of the items array.
Parameters
item
any
The item to add.
Returns
void
Implementation of
beginUpdate()
beginUpdate():
void
Defined in: src/slick/remoteview.ts:200
Begins a batch update; suspends refresh until endUpdate is called.
Returns
void
Implementation of
collapseAllGroups()
collapseAllGroups(
level?):void
Defined in: src/slick/remoteview.ts:827
Collapses all groups at the specified level, or all levels if not specified.
Parameters
level?
number
Optional level to collapse.
Returns
void
Implementation of
collapseGroup()
collapseGroup(
constArgs):void
Defined in: src/slick/remoteview.ts:863
Collapses a specific group.
Parameters
constArgs
any[]
Grouping key or values denoting the group path.
Returns
void
Implementation of
deleteItem()
deleteItem(
id):void
Defined in: src/slick/remoteview.ts:677
Deletes an item by its ID.
Parameters
id
any
The ID of the item to delete.
Returns
void
Implementation of
endUpdate()
endUpdate():
void
Defined in: src/slick/remoteview.ts:205
Ends a batch update and refreshes the view if outermost.
Returns
void
Implementation of
expandAllGroups()
expandAllGroups(
level?):void
Defined in: src/slick/remoteview.ts:835
Expands all groups at the specified level, or all levels if not specified.
Parameters
level?
number
Optional level to expand.
Returns
void
Implementation of
expandGroup()
expandGroup(
constArgs):void
Defined in: src/slick/remoteview.ts:872
Expands a specific group.
Parameters
constArgs
any[]
Grouping key or values denoting the group path.
Returns
void
Implementation of
getFilter()
getFilter():
RemoteViewFilter<TItem>
Defined in: src/slick/remoteview.ts:432
Gets the current filter function.
Returns
RemoteViewFilter<TItem>
The current filter function.
Implementation of
getFilteredItems()
getFilteredItems():
TItem[]
Defined in: src/slick/remoteview.ts:424
Gets the filtered items (after applying the current filter).
Returns
TItem[]
Array of filtered items.
Implementation of
getGrandTotals()
getGrandTotals():
IGroupTotals
Defined in: src/slick/remoteview.ts:467
Gets the grand totals for the view.
Returns
IGroupTotals
The grand totals object.
Implementation of
getGrouping()
getGrouping():
GroupInfo<TItem>[]
Defined in: src/slick/remoteview.ts:449
Gets the current grouping configuration.
Returns
GroupInfo<TItem>[]
Array of grouping information.
Implementation of
getGroupItemMetadataProvider()
getGroupItemMetadataProvider():
GroupItemMetadataProvider
Defined in: src/slick/remoteview.ts:1463
Gets the group item metadata provider.
Returns
GroupItemMetadataProvider
The metadata provider.
Implementation of
IRemoteView.getGroupItemMetadataProvider
getGroups()
getGroups():
Group<TItem>[]
Defined in: src/slick/remoteview.ts:881
Gets the current groups.
Returns
Group<TItem>[]
Array of groups.
Implementation of
getIdPropertyName()
getIdPropertyName():
string
Defined in: src/slick/remoteview.ts:256
Gets the name of the property used as the unique identifier for items.
Returns
string
The ID property name.
Implementation of
getIdxById()
getIdxById(
id):number
Defined in: src/slick/remoteview.ts:524
Gets the index of an item by its ID.
Parameters
id
any
The ID of the item.
Returns
number
The index of the item, or undefined if not found.
Implementation of
getItem()
getItem(
i):any
Defined in: src/slick/remoteview.ts:753
Gets the item at the specified row index.
Parameters
i
number
The row index.
Returns
any
The item at the row.
Implementation of
getItemById()
getItemById(
id):TItem
Defined in: src/slick/remoteview.ts:562
Gets an item by its ID.
Parameters
id
any
The ID of the item.
Returns
TItem
The item with the specified ID.
Implementation of
getItemByIdx()
getItemByIdx(
i):any
Defined in: src/slick/remoteview.ts:515
Gets an item by its index in the items array.
Parameters
i
number
The index of the item.
Returns
any
The item at the specified index.
Implementation of
getItemMetadata()
getItemMetadata(
row):ItemMetadata<TItem>
Defined in: src/slick/remoteview.ts:779
Gets metadata for the specified row.
Parameters
row
number
The row index.
Returns
ItemMetadata<TItem>
The item metadata, or null.
Implementation of
getItemMetadataCallback()
getItemMetadataCallback(): (
item,row) =>ItemMetadata<TItem>
Defined in: src/slick/remoteview.ts:1479
Gets the callback for retrieving item metadata.
Returns
The item metadata callback.
(
item,row):ItemMetadata<TItem>
Parameters
item
TItem
row
number
Returns
ItemMetadata<TItem>
Implementation of
IRemoteView.getItemMetadataCallback
getItems()
getItems():
TItem[]
Defined in: src/slick/remoteview.ts:248
Gets all items in the view.
Returns
TItem[]
Array of all items.
Implementation of
getLength()
getLength():
number
Defined in: src/slick/remoteview.ts:744
Gets the number of rows in the view.
Returns
number
The row count.
Implementation of
getLocalSort()
getLocalSort():
boolean
Defined in: src/slick/remoteview.ts:400
Gets whether local sorting is enabled.
Returns
boolean
True if local sorting is enabled.
Implementation of
getPagingInfo()
getPagingInfo():
PagingInfo
Defined in: src/slick/remoteview.ts:329
Gets the current paging information.
Returns
Object containing paging state.
Implementation of
getRowById()
getRowById(
id):number
Defined in: src/slick/remoteview.ts:552
Gets the row index for an item by its ID.
Parameters
id
any
The ID of the item.
Returns
number
The row index of the item.
Implementation of
getRowByItem()
getRowByItem(
item):number
Defined in: src/slick/remoteview.ts:542
Gets the row index for an item.
Parameters
item
any
The item to find.
Returns
number
The row index of the item.
Implementation of
getRows()
getRows(): (
TItem|Group<any> |GroupTotals<any>)[]
Defined in: src/slick/remoteview.ts:736
Gets all rows in the view (including group rows and totals rows).
Returns
(TItem | Group<any> | GroupTotals<any>)[]
Array of all rows.
Implementation of
insertItem()
insertItem(
insertBefore,item):void
Defined in: src/slick/remoteview.ts:657
Inserts an item at the specified position.
Parameters
insertBefore
number
The index to insert before.
item
any
The item to insert.
Returns
void
Implementation of
mapIdsToRows()
mapIdsToRows(
idArray):any[]
Defined in: src/slick/remoteview.ts:588
Maps an array of IDs to their corresponding row indices.
Parameters
idArray
any[]
Array of item IDs to map
Returns
any[]
Array of row indices
mapItemsToRows()
mapItemsToRows(
itemArray):number[]
Defined in: src/slick/remoteview.ts:571
Maps an array of items to their corresponding row indices.
Parameters
itemArray
any[]
Array of items to map
Returns
number[]
Array of row indices
mapRowsToIds()
mapRowsToIds(
rowArray):any[]
Defined in: src/slick/remoteview.ts:605
Maps an array of row indices to their corresponding item IDs.
Parameters
rowArray
any[]
Array of row indices to map
Returns
any[]
Array of item IDs
populate()
populate():
boolean
Defined in: src/slick/remoteview.ts:1358
Loads data from the server using the configured URL and parameters.
Returns
boolean
False if the operation was cancelled or no URL is configured.
Implementation of
populateLock()
populateLock():
void
Defined in: src/slick/remoteview.ts:1444
Locks population to prevent automatic data loading.
Returns
void
Implementation of
populateUnlock()
populateUnlock():
void
Defined in: src/slick/remoteview.ts:1451
Unlocks population; executes pending populate calls if any.
Returns
void
Implementation of
refresh()
refresh():
void
Defined in: src/slick/remoteview.ts:1156
Refreshes the view by recalculating rows and notifying changes.
Returns
void
Implementation of
reSort()
reSort():
void
Defined in: src/slick/remoteview.ts:416
Re-sorts the items using the current sort settings.
Returns
void
Implementation of
setFilter()
setFilter(
filterFn):void
Defined in: src/slick/remoteview.ts:440
Sets the filter function to apply to items.
Parameters
filterFn
RemoteViewFilter<TItem>
The filter function to apply.
Returns
void
Implementation of
setGrouping()
setGrouping(
groupingInfo):void
Defined in: src/slick/remoteview.ts:491
Sets the grouping configuration for the view.
Parameters
groupingInfo
Grouping information or array of grouping information.
GroupInfo<TItem> | GroupInfo<TItem>[]
Returns
void
Implementation of
setGroupItemMetadataProvider()
setGroupItemMetadataProvider(
value):void
Defined in: src/slick/remoteview.ts:1471
Sets the group item metadata provider.
Parameters
value
GroupItemMetadataProvider
The metadata provider to set.
Returns
void
Implementation of
IRemoteView.setGroupItemMetadataProvider
setItemMetadataCallback()
setItemMetadataCallback(
value):void
Defined in: src/slick/remoteview.ts:1487
Sets the callback for retrieving item metadata.
Parameters
value
(item, row) => ItemMetadata<TItem>
The item metadata callback.
Returns
void
Implementation of
IRemoteView.setItemMetadataCallback
setItems()
setItems(
data,newIdProperty?):void
Defined in: src/slick/remoteview.ts:265
Sets the items in the view and optionally changes the ID property.
Parameters
data
any[]
Array of items to set.
newIdProperty?
Optional new ID property name.
string | boolean
Returns
void
Implementation of
setLocalSort()
setLocalSort(
value):void
Defined in: src/slick/remoteview.ts:408
Sets whether to use local sorting.
Parameters
value
boolean
Whether to enable local sorting.
Returns
void
Implementation of
setPagingOptions()
setPagingOptions(
args):void
Defined in: src/slick/remoteview.ts:294
Sets paging options and triggers a data reload if options changed.
Parameters
args
The paging options to set.
Returns
void
Implementation of
setRefreshHints()
setRefreshHints(
hints):void
Defined in: src/slick/remoteview.ts:215
Sets hints for the next refresh operation to optimize performance.
Parameters
hints
any
Object containing refresh hints like isFilterNarrowing, isFilterExpanding, etc.
Returns
void
setSummaryOptions()
setSummaryOptions(
summary):void
Defined in: src/slick/remoteview.ts:457
Sets summary/aggregation options for the view.
Parameters
summary
Object containing aggregators and other summary options.
Returns
void
Implementation of
sort()
sort(
comparer?,ascending?):void
Defined in: src/slick/remoteview.ts:379
Sorts the items using the specified comparer.
Parameters
comparer?
(a, b) => number
Optional custom comparer function.
ascending?
boolean
Whether to sort in ascending order.
Returns
void
Implementation of
sortedAddItem()
sortedAddItem(
item):void
Defined in: src/slick/remoteview.ts:692
Adds an item in sorted order.
Parameters
item
any
The item to add.
Returns
void
Implementation of
sortedUpdateItem()
sortedUpdateItem(
id,item):void
Defined in: src/slick/remoteview.ts:701
Updates an item while maintaining sorted order.
Parameters
id
any
The ID of the item to update.
item
any
The new item data.
Returns
void
Implementation of
syncGridCellCssStyles()
syncGridCellCssStyles(
grid,key):void
Defined in: src/slick/remoteview.ts:1265
Syncs cell CSS styles between the grid and the data view.
Parameters
grid
ISleekGrid
The grid to sync with.
key
string
The CSS style key.
Returns
void
Implementation of
IRemoteView.syncGridCellCssStyles
syncGridSelection()
syncGridSelection(
sleekGrid,preserveHidden?,preserveHiddenOnSelectionChange?):EventEmitter<any>
Defined in: src/slick/remoteview.ts:1209
Wires the grid and the DataView together to keep row selection tied to item ids. This is useful since, without it, the grid only knows about rows, so if the items move around, the same rows stay selected instead of the selection moving along with the items.
NOTE: This doesn't work with cell selection model.
Parameters
sleekGrid
ISleekGrid
The grid to sync selection with.
preserveHidden?
boolean
Whether to keep selected items that go out of the view due to them getting filtered out.
preserveHiddenOnSelectionChange?
boolean
Whether to keep selected items that are currently out of the view (see preserveHidden) as selected when selection changes.
Returns
EventEmitter<any>
An event that notifies when an internal list of selected row ids changes. This is useful since, in combination with the above two options, it allows access to the full list selected row ids, and not just the ones visible to the grid.
Implementation of
updateItem()
updateItem(
id,item):void
Defined in: src/slick/remoteview.ts:620
Updates an existing item in the view.
Parameters
id
any
The ID of the item to update.
item
any
The new item data.
Returns
void