Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc] Add List's perPage and pagination.rowsPerPages props relationship note #8244

Merged
merged 4 commits into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion docs/List.md
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,21 @@ export const PostList = () => (
);
```

**Note**: The default pagination component's `rowsPerPageOptions` includes options of 5, 10, 25 and 50. If you set your List `perPage` to a value not in that set, you must also customize the pagination so that it allows this value, or else there will be an error.

```diff
// in src/MyPagination.js
-import { List } from 'react-admin';
+import { List, Pagination } from 'react-admin';

export const PostList = () => (
- <List perPage={6}>
+ <List perPage={6} pagination={<Pagination rowsPerPageOptions={[6, 12, 24, 36]} />}>
...
</List>
);
```

## `queryOptions`

`<List>` accepts a `queryOptions` prop to pass options to the react-query client.
Expand Down Expand Up @@ -848,4 +863,4 @@ const PostList = () => (
</List>
);
```
{% endraw %}
{% endraw %}
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ Pagination.propTypes = {
};

const DefaultLimit = <PaginationLimit />;
const DefaultRowsPerPageOptions = [5, 10, 25];
const DefaultRowsPerPageOptions = [5, 10, 25, 50];
const emptyArray = [];

export interface PaginationProps
Expand Down