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

[Data Grid] Add hidePerPageOptions prop into EuiDataGridPaginationProps #3700

Merged
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Added `hidePerPageOptions` prop into `EuiDataGridPaginationProps` ([#3700](https://github.com/elastic/eui/pull/3700))
- Added `paddingSize` prop to `EuiCard` ([#3638](https://github.com/elastic/eui/pull/3638))
- Added `isClearable` and `placeholder` options to `EuiColorPicker` ([#3689](https://github.com/elastic/eui/pull/3689))
- Added SASS helper files for EUI theme globals ([#3691](https://github.com/elastic/eui/pull/3691))
Expand Down
1 change: 1 addition & 0 deletions src-docs/src/views/datagrid/datagrid_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const gridSnippet = `
}
// Optional. Add pagination.
pagination={{
hidePerPageOptions: true,
pageIndex: 1,
pageSize: 100,
pageSizeOptions: [50, 100, 200],
Expand Down
2 changes: 2 additions & 0 deletions src/components/datagrid/data_grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ function renderPagination(props: EuiDataGridProps, controls: string) {
}

const {
hidePerPageOptions,
pageIndex,
pageSize,
pageSizeOptions,
Expand Down Expand Up @@ -247,6 +248,7 @@ function renderPagination(props: EuiDataGridProps, controls: string) {
<EuiTablePagination
aria-controls={controls}
activePage={pageIndex}
hidePerPageOptions={hidePerPageOptions}
itemsPerPage={pageSize}
itemsPerPageOptions={pageSizeOptions}
pageCount={pageCount}
Expand Down
4 changes: 4 additions & 0 deletions src/components/datagrid/data_grid_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ export interface EuiDataGridToolBarVisibilityOptions {
// but TypeScript's default understanding of an array is number[] unless `as const` is used
// which defeats the generic's purpose & functionality as it would check for `number` in `number[]`
export interface EuiDataGridPaginationProps {
/**
* Hide per page options if necessary
*/
hidePerPageOptions?: boolean;
/**
* The index of the current page, starts at 0 for the first page
*/
Expand Down