TinyBase logoTinyBase

ResultSortedRowIdsListener

The ResultSortedRowIdsListener type describes a function that is used to listen to changes to the sorted ResultRow Ids in a query's ResultTable.

(
  queries: Queries,
  tableId: Id,
  cellId: Id | undefined,
  descending: boolean,
  offset: number,
  limit: number | undefined,
  sortedRowIds: Ids,
): void
TypeDescription
queriesQueries

A reference to the Queries object that changed.

tableIdId

The Id of the ResultTable that changed, which is also the query Id.

cellIdId | undefined

The Id of the ResultCell whose values were used for the sorting.

descendingboolean

Whether the sorting was in descending order.

offsetnumber

The number of ResultRow Ids skipped.

limitnumber | undefined

The maximum number of ResultRow Ids returned.

sortedRowIdsIds

The sorted ResultRow Ids themselves.

returnsvoid

This has no return value.

A ResultSortedRowIdsListener is provided when using the addResultSortedRowIdsListener method. See that method for specific examples.

When called, a ResultSortedRowIdsListener is given a reference to the Queries object, the Id of the ResultTable whose ResultRow Ids changed (which is the same as the query Id), the ResultCell Id being used to sort them, whether descending or not, and the offset and limit of the number of Ids returned, for pagination purposes. It also receives the sorted array of Ids itself, so that you can use them in the listener without the additional cost of an explicit call to getResultSortedRowIds.

You can create new query definitions within the body of this listener, though obviously be aware of the possible cascading effects of doing so.

Since

v2.0.0