Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DataPage<T>

Data transfer object that is used to pass results of paginated queries. It contains items of retrieved page and optional total number of items.

Most often this object type is used to send responses to paginated queries. Pagination parameters are defined by PagingParams object. The skip parameter in the PagingParams there means how many items to skip. The takes parameter sets number of items to return in the page. And the optional total parameter tells to return total number of items in the query.

Remember: not all implementations support the total parameter because its generation may lead to severe performance implications.

see

PagingParams

Example

myDataClient.getDataByFilter(
    "123",
    FilterParams.fromTuples("completed": true),
    new PagingParams(0, 100, true),
    (err: any, page: DataPage<MyData>) => {
        if (err == null) {
            console.log("Items: ");
            for (let item of page.Data) {
                console.log(item);
            }
            console.log("Total items: " + page.total);
        }
    };
);

Type parameters

  • T

Hierarchy

  • DataPage

Index

Constructors

Properties

Constructors

constructor

  • new DataPage(data?: T[], total?: number): DataPage
  • Creates a new instance of data page and assigns its values.

    Parameters

    • Default value data: T[] = null

      a list of items from the retrieved page.

    • Default value total: number = null

      (optional) .

    Returns DataPage

Properties

data

data: T[]

The items of the retrieved page.

total

total: number

The total amount of items in a request.

Generated using TypeDoc