@serenity-is/corelib / RemoteView

Class: RemoteView<TItem>

Defined in: src/slick/remoteview.ts:42

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

Constructors

Constructor

new RemoteView<TItem>(options): RemoteView<TItem>

Defined in: src/slick/remoteview.ts:96

Parameters

options

RemoteViewOptions<TItem>

Returns

RemoteView<TItem>

Properties

onAjaxCall

onAjaxCall: RemoteViewAjaxCallback<TItem>

Defined in: src/slick/remoteview.ts:83

Callback invoked before making AJAX calls

Implementation of

IRemoteView.onAjaxCall


onDataChanged

readonly onDataChanged: EventEmitter<ArgsRemoteView, { }>

Defined in: src/slick/remoteview.ts:86

Event fired when the underlying data changes

Implementation of

IRemoteView.onDataChanged


onDataLoaded

readonly onDataLoaded: EventEmitter<ArgsRemoteView, { }>

Defined in: src/slick/remoteview.ts:87

Event fired when data loading completes

Implementation of

IRemoteView.onDataLoaded


onDataLoading

readonly onDataLoading: EventEmitter<ArgsRemoteView, { }>

Defined in: src/slick/remoteview.ts:88

Event fired when data loading begins

Implementation of

IRemoteView.onDataLoading


onGroupCollapsed

readonly onGroupCollapsed: EventEmitter<ArgsGroupToggle, { }>

Defined in: src/slick/remoteview.ts:89

Event fired when a group is collapsed

Implementation of

IRemoteView.onGroupCollapsed


onGroupExpanded

readonly onGroupExpanded: EventEmitter<ArgsGroupToggle, { }>

Defined in: src/slick/remoteview.ts:90

Event fired when a group is expanded

Implementation of

IRemoteView.onGroupExpanded


onPagingInfoChanged

readonly onPagingInfoChanged: EventEmitter<ArgsPagingInfo, { }>

Defined in: src/slick/remoteview.ts:91

Event fired when paging information changes

Implementation of

IRemoteView.onPagingInfoChanged


onProcessData

onProcessData: RemoteViewProcessCallback<TItem>

Defined in: src/slick/remoteview.ts:84

Callback invoked to process data received from the server

Implementation of

IRemoteView.onProcessData


onRowCountChanged

readonly onRowCountChanged: EventEmitter<ArgsRowCountChanged, { }>

Defined in: src/slick/remoteview.ts:92

Event fired when the row count changes

Implementation of

IRemoteView.onRowCountChanged


onRowsChanged

readonly onRowsChanged: EventEmitter<ArgsRowsChanged, { }>

Defined in: src/slick/remoteview.ts:93

Event fired when specific rows change

Implementation of

IRemoteView.onRowsChanged


onRowsOrCountChanged

readonly onRowsOrCountChanged: EventEmitter<ArgsRowsOrCountChanged, { }>

Defined in: src/slick/remoteview.ts:94

Event fired when rows or count change

Implementation of

IRemoteView.onRowsOrCountChanged


onSubmit

onSubmit: CancellableViewCallback<TItem>

Defined in: src/slick/remoteview.ts:85

Callback invoked before submitting a request, can cancel the operation

Implementation of

IRemoteView.onSubmit


params

params: Record<string, any>

Defined in: src/slick/remoteview.ts:78

Additional parameters to send with service requests

Implementation of

IRemoteView.params


seekToPage

seekToPage: number

Defined in: src/slick/remoteview.ts:79

The page number to seek to when loading data

Implementation of

IRemoteView.seekToPage


sortBy

sortBy: string[]

Defined in: src/slick/remoteview.ts:80

Sort expressions for the data

Implementation of

IRemoteView.sortBy


url

url: string

Defined in: src/slick/remoteview.ts:81

The URL to fetch data from

Implementation of

IRemoteView.url


groupingInfoDefaults

readonly static groupingInfoDefaults: GroupInfo<any>

Defined in: src/slick/remoteview.ts:122

Default configuration for grouping information

Accessors

idField

Get Signature

get idField(): string

Defined in: src/slick/remoteview.ts:1226

Deprecated

Gets the ID property name, for compatibility

Returns

string

Methods

addData()

addData(data): boolean

Defined in: src/slick/remoteview.ts:1084

Adds data received from the server to the view.

Parameters

data

any

The response data from the server

Returns

boolean

Implementation of

IRemoteView.addData


addItem()

addItem(item): void

Defined in: src/slick/remoteview.ts:501

Adds an item to the end of the items array.

Parameters

item

any

The item to add

Returns

void

Implementation of

IRemoteView.addItem


beginUpdate()

beginUpdate(): void

Defined in: src/slick/remoteview.ts:137

Begins a batch update operation. Multiple changes can be made without triggering refreshes. Call endUpdate() to complete the batch and refresh the view.

Returns

void

Implementation of

IRemoteView.beginUpdate


collapseAllGroups()

collapseAllGroups(level?): void

Defined in: src/slick/remoteview.ts:626

Collapses all groups at the specified level, or all levels if not specified.

Parameters

level?

number

Optional level to collapse. If not specified, applies to all levels.

Returns

void

Implementation of

IRemoteView.collapseAllGroups


collapseGroup()

collapseGroup(constArgs): void

Defined in: src/slick/remoteview.ts:654

Collapses a specific group.

Parameters

constArgs

any[]

Returns

void

Implementation of

IRemoteView.collapseGroup


deleteItem()

deleteItem(id): void

Defined in: src/slick/remoteview.ts:507

Deletes an item by its ID.

Parameters

id

any

The ID of the item to delete

Returns

void

Implementation of

IRemoteView.deleteItem


endUpdate()

endUpdate(): void

Defined in: src/slick/remoteview.ts:141

Ends a batch update operation. If this is the outermost endUpdate call, refreshes the view to reflect all changes made during the batch.

Returns

void

Implementation of

IRemoteView.endUpdate


expandAllGroups()

expandAllGroups(level?): void

Defined in: src/slick/remoteview.ts:630

Expands all groups at the specified level, or all levels if not specified.

Parameters

level?

number

Optional level to expand. If not specified, applies to all levels.

Returns

void

Implementation of

IRemoteView.expandAllGroups


expandGroup()

expandGroup(constArgs): void

Defined in: src/slick/remoteview.ts:659

Expands a specific group.

Parameters

constArgs

any[]

Returns

void

Implementation of

IRemoteView.expandGroup


getFilter()

getFilter(): RemoteViewFilter<TItem>

Defined in: src/slick/remoteview.ts:325

Gets the current filter function.

Returns

RemoteViewFilter<TItem>

The current filter function

Implementation of

IRemoteView.getFilter


getFilteredItems()

getFilteredItems(): any[]

Defined in: src/slick/remoteview.ts:321

Gets the filtered items (after applying the current filter).

Returns

any[]

Array of filtered items

Implementation of

IRemoteView.getFilteredItems


getGrandTotals()

getGrandTotals(): IGroupTotals

Defined in: src/slick/remoteview.ts:344

Gets the grand totals for all aggregated data.

Returns

IGroupTotals

Implementation of

IRemoteView.getGrandTotals


getGrouping()

getGrouping(): GroupInfo<TItem>[]

Defined in: src/slick/remoteview.ts:334

Gets the current grouping configuration.

Returns

GroupInfo<TItem>[]

Array of grouping information

Implementation of

IRemoteView.getGrouping


getGroupItemMetadataProvider()

getGroupItemMetadataProvider(): GroupItemMetadataProvider

Defined in: src/slick/remoteview.ts:1217

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:664

Gets the current groups.

Returns

Group<TItem>[]

Array of groups

Implementation of

IRemoteView.getGroups


getIdPropertyName()

getIdPropertyName(): string

Defined in: src/slick/remoteview.ts:184

Gets the name of the property used as the unique identifier for items.

Returns

string

The ID property name

Implementation of

IRemoteView.getIdPropertyName


getIdxById()

getIdxById(id): number

Defined in: src/slick/remoteview.ts:387

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

IRemoteView.getIdxById


getItem()

getItem(i): any

Defined in: src/slick/remoteview.ts:561

Gets the item at the specified row index.

Parameters

i

number

Returns

any

Implementation of

IRemoteView.getItem


getItemById()

getItemById(id): TItem

Defined in: src/slick/remoteview.ts:410

Gets an item by its ID.

Parameters

id

any

The ID of the item

Returns

TItem

The item with the specified ID

Implementation of

IRemoteView.getItemById


getItemByIdx()

getItemByIdx(i): any

Defined in: src/slick/remoteview.ts:383

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

IRemoteView.getItemByIdx


getItemMetadata()

getItemMetadata(row): any

Defined in: src/slick/remoteview.ts:582

Gets metadata for the item at the specified row index.

Parameters

row

number

Returns

any

Implementation of

IRemoteView.getItemMetadata


getItems()

getItems(): TItem[]

Defined in: src/slick/remoteview.ts:180

Gets all items in the view.

Returns

TItem[]

Array of all items

Implementation of

IRemoteView.getItems


getLength()

getLength(): number

Defined in: src/slick/remoteview.ts:557

Gets the total number of rows in the view.

Returns

number

Implementation of

IRemoteView.getLength


getLocalSort()

getLocalSort(): boolean

Defined in: src/slick/remoteview.ts:306

Gets whether local sorting is enabled.

Returns

boolean

true if local sorting is enabled

Implementation of

IRemoteView.getLocalSort


getPagingInfo()

getPagingInfo(): PagingInfo

Defined in: src/slick/remoteview.ts:244

Gets the current paging information.

Returns

PagingInfo

Object containing paging state information

Implementation of

IRemoteView.getPagingInfo


getRowById()

getRowById(id): number

Defined in: src/slick/remoteview.ts:405

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

IRemoteView.getRowById


getRowByItem()

getRowByItem(item): number

Defined in: src/slick/remoteview.ts:400

Gets the row index for an item.

Parameters

item

any

The item to find

Returns

number

The row index of the item

Implementation of

IRemoteView.getRowByItem


getRows()

getRows(): (TItem | Group<any> | GroupTotals<any>)[]

Defined in: src/slick/remoteview.ts:553

Gets all rows in the view (including group rows and totals rows).

Returns

(TItem | Group<any> | GroupTotals<any>)[]

Array of all rows

Implementation of

IRemoteView.getRows


insertItem()

insertItem(insertBefore, item): void

Defined in: src/slick/remoteview.ts:495

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

IRemoteView.insertItem


mapIdsToRows()

mapIdsToRows(idArray): any[]

Defined in: src/slick/remoteview.ts:436

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:419

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:453

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:1118

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

IRemoteView.populate


populateLock()

populateLock(): void

Defined in: src/slick/remoteview.ts:1203

Locks population to prevent automatic data loading. Use this when you want to make multiple changes without triggering loads.

Returns

void

Implementation of

IRemoteView.populateLock


populateUnlock()

populateUnlock(): void

Defined in: src/slick/remoteview.ts:1209

Unlocks population. If there were pending populate calls while locked, executes them.

Returns

void

Implementation of

IRemoteView.populateUnlock


refresh()

refresh(): void

Defined in: src/slick/remoteview.ts:930

Refresh the view by recalculating the rows and notifying changes. Note that this does not re-fetch the data from the server, use populate method for that purpose.

Returns

void

Implementation of

IRemoteView.refresh


reSort()

reSort(): void

Defined in: src/slick/remoteview.ts:317

Re-sorts the items using the current sort settings.

Returns

void

Implementation of

IRemoteView.reSort


setFilter()

setFilter(filterFn): void

Defined in: src/slick/remoteview.ts:329

Sets the filter function to apply to items.

Parameters

filterFn

RemoteViewFilter<TItem>

The filter function to apply

Returns

void

Implementation of

IRemoteView.setFilter


setGrouping()

setGrouping(groupingInfo): void

Defined in: src/slick/remoteview.ts:364

Sets the grouping configuration for the view.

Parameters

groupingInfo

Grouping information or array of grouping information

GroupInfo<TItem> | GroupInfo<TItem>[]

Returns

void

Implementation of

IRemoteView.setGrouping


setGroupItemMetadataProvider()

setGroupItemMetadataProvider(value): void

Defined in: src/slick/remoteview.ts:1221

Sets the group item metadata provider.

Parameters

value

GroupItemMetadataProvider

The metadata provider to set

Returns

void

Implementation of

IRemoteView.setGroupItemMetadataProvider


setItems()

setItems(data, newIdProperty?): void

Defined in: src/slick/remoteview.ts:188

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, or boolean to reset

string | boolean

Returns

void

Implementation of

IRemoteView.setItems


setLocalSort()

setLocalSort(value): void

Defined in: src/slick/remoteview.ts:310

Sets whether to use local sorting. When enabled, sorting is done client-side.

Parameters

value

boolean

Whether to enable local sorting

Returns

void

Implementation of

IRemoteView.setLocalSort


setPagingOptions()

setPagingOptions(args): void

Defined in: src/slick/remoteview.ts:213

Sets paging options and triggers a data reload if options changed.

Parameters

args

PagingOptions

The paging options to set

Returns

void

Implementation of

IRemoteView.setPagingOptions


setRefreshHints()

setRefreshHints(hints): void

Defined in: src/slick/remoteview.ts:151

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:338

Sets summary/aggregation options for the view.

Parameters

summary

SummaryOptions

Object containing aggregators and other summary options

Returns

void

Implementation of

IRemoteView.setSummaryOptions


sort()

sort(comparer?, ascending?): void

Defined in: src/slick/remoteview.ts:289

Sorts the items using the specified comparer function.

Parameters

comparer?

(a, b) => number

Optional custom comparer function

ascending?

boolean

Whether to sort in ascending order (default true)

Returns

void

Implementation of

IRemoteView.sort


sortedAddItem()

sortedAddItem(item): void

Defined in: src/slick/remoteview.ts:518

Adds an item in sorted order.

Parameters

item

any

The item to add

Returns

void

Implementation of

IRemoteView.sortedAddItem


sortedUpdateItem()

sortedUpdateItem(id, item): void

Defined in: src/slick/remoteview.ts:522

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

IRemoteView.sortedUpdateItem


syncGridCellCssStyles()

syncGridCellCssStyles(grid, key): void

Defined in: src/slick/remoteview.ts:1034

Syncs cell CSS styles between the grid and the data view.

Parameters

grid

ISleekGrid

key

string

Returns

void

Implementation of

IRemoteView.syncGridCellCssStyles


syncGridSelection()

syncGridSelection(sleekGrid, preserveHidden?, preserveHiddenOnSelectionChange?): EventEmitter<any>

Defined in: src/slick/remoteview.ts:983

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

IRemoteView.syncGridSelection


updateItem()

updateItem(id, item): void

Defined in: src/slick/remoteview.ts:463

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

Implementation of

IRemoteView.updateItem