Skip to content

@serenity-is/sleekgrid / IDataView

Interface: IDataView<TItem>

Defined in: src/core/idataview.ts:21

Minimal data-view contract consumed by the grid. Implemented by DataView.

Type Parameters

TItem

TItem = any

Row item type.

Properties

onDataChanged?

readonly optional onDataChanged: EventEmitter<{ }>

Defined in: src/core/idataview.ts:65

Event fired when the underlying data set changes.


onRowCountChanged?

readonly optional onRowCountChanged: EventEmitter<{ current: number; previous: number; }>

Defined in: src/core/idataview.ts:70

Event fired when the row count changes. Payload is { previous, current } with the counts before and after the change.


onRowsChanged?

readonly optional onRowsChanged: EventEmitter<{ rows: number[]; }>

Defined in: src/core/idataview.ts:75

Event fired when specific view rows change (values or metadata). Payload is { rows } with the list of affected view indices.

Methods

getGrandTotals()

getGrandTotals(): IGroupTotals

Defined in: src/core/idataview.ts:26

Gets grand totals aggregated over the entire data set.

Returns

IGroupTotals

Grand totals object containing sum/avg/min/max, if any.


getGrouping()?

optional getGrouping(): IDataViewGroupingInfo[]

Defined in: src/core/idataview.ts:63

Gets the grouping of the rows, when the view groups them, so that the grid can render the rows of a group, e.g. where the totals of a group go.

Returns

IDataViewGroupingInfo[]

The grouping information, one for each level, or undefined when not grouped.


getItem()

getItem(row): IGroupTotals<any> | TItem | Group<TItem>

Defined in: src/core/idataview.ts:37

Gets the item at the specified view row.

Parameters

row

number

Zero-based view index.

Returns

IGroupTotals<any> | TItem | Group<TItem>

Data item, Group header, or IGroupTotals row.


getItemMetadata()?

optional getItemMetadata(row): ItemMetadata<TItem>

Defined in: src/core/idataview.ts:43

Gets row metadata (CSS classes, per-column overrides) for the specified view row.

Parameters

row

number

Zero-based view index.

Returns

ItemMetadata<TItem>

Metadata object or undefined when none applies.


getLength()

getLength(): number

Defined in: src/core/idataview.ts:31

Gets the total number of rows currently in the view (including group headers/totals).

Returns

number

Row count.


getRowStripe()?

optional getRowStripe(row): "odd" | "even"

Defined in: src/core/idataview.ts:51

Gets the stripe (odd / even row style) of the specified view row. When not implemented, rows are striped by their index. Grouping views use it to start each group with an odd row like the first row of the grid, and to leave group header and totals rows unstriped.

Parameters

row

number

Zero-based view index.

Returns

"odd" | "even"

"odd", "even", or null for a row that has neither class.


setGroupItemMetadataProvider()?

optional setGroupItemMetadataProvider(provider): void

Defined in: src/core/idataview.ts:57

Sets the provider that gives the metadata of the rows of a group, so that the view and the grid share one instance, which is what lets the provider read the columns of the grid.

Parameters

provider

IGroupItemMetadataProvider

The provider, or null when the grid no longer has one.

Returns

void