Pagination
The footer shows the current range and lets people change page and page size. Pages are zero-based.
Basic usage
pagination.tsx
import { useState } from 'react';
import { DataGrid, type PaginationModel } from 'expo-flash-datagrid';
import { userColumns, users, type User } from './data';
export function PaginationScreen() {
const [paginationModel, setPaginationModel] = useState<PaginationModel>({
page: 0,
pageSize: 10,
});
return (
<DataGrid<User>
mode="client"
rows={users}
columns={userColumns}
paginationModel={paginationModel}
onPaginationModelChange={setPaginationModel}
pageSizeOptions={[10, 20, 40]}
style={{ flex: 1 }}
/>
);
}
Options
| Prop | Type | Default | Description |
|---|---|---|---|
paginationModel | PaginationModel | { page: 0, pageSize: 25 } | Controlled page and size. |
onPaginationModelChange | (next: PaginationModel) => void | None | Called when either changes. |
pageSizeOptions | number[] | [10, 25, 50, 100] | Sizes offered in the footer. |
rowCount | number | rows.length | Total rows on the server. Server mode only. |
Client vs server
In client mode the grid slices the processed rows. In server mode, rows must already be the current page, and rowCount tells the footer how many exist.