Skip to content

Commit

Permalink
[TablePagination] Make onChangeRowsPerPage optional (#9563)
Browse files Browse the repository at this point in the history
The select option is now hidden if configured with < 2 options, so it seems as though this should be optional.
  • Loading branch information
evantrimboli authored and oliviertassinari committed Dec 20, 2017
1 parent 26d57f6 commit e807a62
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pages/api/table-pagination.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ A `TableCell` based component for placing inside `TableFooter` for pagination.
| labelDisplayedRows | func | ({ from, to, count }) => `${from}-${to} of ${count}` | Useful to customize the displayed rows label. |
| labelRowsPerPage | node | 'Rows per page:' | Useful to customize the rows per page label. Invoked with a `{ from, to, count, page }` object. |
| <span style="color: #31a148">onChangePage *</span> | func | | Callback fired when the page is changed.<br><br>**Signature:**<br>`function(event: object, page: number) => void`<br>*event:* The event source of the callback<br>*page:* The page selected |
| <span style="color: #31a148">onChangeRowsPerPage*</span> | func | | Callback fired when the number of rows per page is changed.<br><br>**Signature:**<br>`function(event: object) => void`<br>*event:* The event source of the callback |
| onChangeRowsPerPage | func | | Callback fired when the number of rows per page is changed.<br><br>**Signature:**<br>`function(event: object) => void`<br>*event:* The event source of the callback |
| <span style="color: #31a148">page *</span> | number | | The zero-based index of the current page. |
| <span style="color: #31a148">rowsPerPage *</span> | number | | The number of rows per page. |
| rowsPerPageOptions | array | [5, 10, 25] | Customizes the options of the rows per page select field. If less than two options are available, no select field will be displayed. |
Expand Down
2 changes: 1 addition & 1 deletion src/Table/TablePagination.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface TablePaginationProps extends StandardProps<
labelDisplayedRows?: (paginationInfo: LabelDisplayedRowsArgs) => React.ReactNode;
labelRowsPerPage?: React.ReactNode;
onChangePage: (event: React.MouseEvent<HTMLButtonElement> | null, page: number) => void;
onChangeRowsPerPage: React.ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>;
onChangeRowsPerPage?: React.ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>;
page: number;
rowsPerPage: number;
rowsPerPageOptions?: number[];
Expand Down
2 changes: 1 addition & 1 deletion src/Table/TablePagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ TablePagination.propTypes = {
*
* @param {object} event The event source of the callback
*/
onChangeRowsPerPage: PropTypes.func.isRequired,
onChangeRowsPerPage: PropTypes.func,
/**
* The zero-based index of the current page.
*/
Expand Down

0 comments on commit e807a62

Please sign in to comment.