Skip to content
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
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)

- Fixed `EuiDataGrid`'s pagination visibility when changing rows per page ([#2978](https://github.com/elastic/eui/pull/2978))
- Added `highlightAll` prop to `EuiHighlight` to highlight all matches ([#2957](https://github.com/elastic/eui/pull/2957))
- Added `showOnFocus` prop to `EuiScreenReaderOnly` to force display on keyboard focus ([#2976](https://github.com/elastic/eui/pull/2976))
- Added `EuiSkipLink` component ([#2976](https://github.com/elastic/eui/pull/2976))
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/datagrid/additional_controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class DataGridContainer extends Component {

setPageSize = pageSize =>
this.setState(({ pagination }) => ({
pagination: { ...pagination, pageSize },
pagination: { ...pagination, pageSize, pageIndex: 0 },
}));

setVisibleColumns = visibleColumns => this.setState({ visibleColumns });
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/datagrid/column_widths.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default class DataGrid extends Component {

setPageSize = pageSize =>
this.setState(({ pagination }) => ({
pagination: { ...pagination, pageSize },
pagination: { ...pagination, pageSize, pageIndex: 0 },
}));

setVisibleColumns = visibleColumns => this.setState({ visibleColumns });
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/datagrid/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default class DataGridContainer extends Component {

setPageSize = pageSize =>
this.setState(({ pagination }) => ({
pagination: { ...pagination, pageSize },
pagination: { ...pagination, pageSize, pageIndex: 0 },
}));

setVisibleColumns = visibleColumns => this.setState({ visibleColumns });
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/datagrid/control_columns.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ export default function DataGrid() {
[pagination, setPagination]
);
const setPageSize = useCallback(
pageSize => setPagination({ ...pagination, pageSize }),
pageSize => setPagination({ ...pagination, pageSize, pageIndex: 0 }),
[pagination, setPagination]
);

Expand Down
3 changes: 2 additions & 1 deletion src-docs/src/views/datagrid/datagrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ export default () => {
// ** Pagination config
const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 });
const onChangeItemsPerPage = useCallback(
pageSize => setPagination(pagination => ({ ...pagination, pageSize })),
pageSize =>
setPagination(pagination => ({ ...pagination, pageSize, pageIndex: 0 })),
[setPagination]
);
const onChangePage = useCallback(
Expand Down
3 changes: 2 additions & 1 deletion src-docs/src/views/datagrid/in_memory.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ export default () => {
// ** Pagination config
const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 });
const onChangeItemsPerPage = useCallback(
pageSize => setPagination(pagination => ({ ...pagination, pageSize })),
pageSize =>
setPagination(pagination => ({ ...pagination, pageSize, pageIndex: 0 })),
[setPagination]
);
const onChangePage = useCallback(
Expand Down
3 changes: 2 additions & 1 deletion src-docs/src/views/datagrid/in_memory_enhancements.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export default () => {
// ** Pagination config
const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 });
const onChangeItemsPerPage = useCallback(
pageSize => setPagination(pagination => ({ ...pagination, pageSize })),
pageSize =>
setPagination(pagination => ({ ...pagination, pageSize, pageIndex: 0 })),
[setPagination]
);
const onChangePage = useCallback(
Expand Down
3 changes: 2 additions & 1 deletion src-docs/src/views/datagrid/in_memory_pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export default () => {
// ** Pagination config
const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 });
const onChangeItemsPerPage = useCallback(
pageSize => setPagination(pagination => ({ ...pagination, pageSize })),
pageSize =>
setPagination(pagination => ({ ...pagination, pageSize, pageIndex: 0 })),
[setPagination]
);
const onChangePage = useCallback(
Expand Down
3 changes: 2 additions & 1 deletion src-docs/src/views/datagrid/in_memory_sorting.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export default () => {
// ** Pagination config
const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 });
const onChangeItemsPerPage = useCallback(
pageSize => setPagination(pagination => ({ ...pagination, pageSize })),
pageSize =>
setPagination(pagination => ({ ...pagination, pageSize, pageIndex: 0 })),
[setPagination]
);
const onChangePage = useCallback(
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/datagrid/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export default class DataGridSchema extends Component {

setPageSize = pageSize =>
this.setState(({ pagination }) => ({
pagination: { ...pagination, pageSize },
pagination: { ...pagination, pageSize, pageIndex: 0 },
}));

setVisibleColumns = visibleColumns => this.setState({ visibleColumns });
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/datagrid/styling.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export default class DataGrid extends Component {

setPageSize = pageSize =>
this.setState(({ pagination }) => ({
pagination: { ...pagination, pageSize },
pagination: { ...pagination, pageSize, pageIndex: 0 },
}));

setVisibleColumns = visibleColumns => this.setState({ visibleColumns });
Expand Down
3 changes: 2 additions & 1 deletion src/components/datagrid/data_grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,10 @@ function renderPagination(props: EuiDataGridProps) {
onChangePage,
onChangeItemsPerPage,
} = pagination;

const pageCount = Math.ceil(props.rowCount / pageSize);

if (pageCount === 1) {
if (props.rowCount < pageSizeOptions[0]) {
return null;
}

Expand Down