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

EuiInMemoryTable pagination does not render correct items #1007

Closed
justinkambic opened this issue Jul 12, 2018 · 0 comments
Closed

EuiInMemoryTable pagination does not render correct items #1007

justinkambic opened this issue Jul 12, 2018 · 0 comments
Labels
bug documentation Issues or PRs that only affect documentation - will not need changelog entries

Comments

@justinkambic
Copy link
Contributor

Issue

I'm attempting to supply custom pagination to an EuiInMemoryTable and it's not working.

The function where I'm rendering my table looks like this:

renderTable() => {
  const {
      pageIndex,
      pageSize,
      pipelines,
      // etc
    } = this.state;
  const pagination = {
      pageIndex,
      pageSize,
      totalItemCount: pipelines.length,
      pageSizeOptions: [2, 3, 5, 8]
    };

  //etc...

  return (
      <EuiInMemoryTable
        columns={this.columns}
        itemId="id"
        items={this.state.pipelines}
        message={this.state.message}
        onChange={this.onTableChange}
        pagination={pagination}
        search={search}
        sorting={true}
        isSelectable={true}
        selection={selectionOptions}
      />
    );
}

and the onChange function that's handling table changes:

onTableChange = (props) => {
    const {
      page: {
        index,
        size,
      }
    } = props;

    this.setState({
      pageIndex: index,
      pageSize: size,
    });
  };

onChange is firing and providing the updated criteria changes, and when the component is re-rendered, it is updating the pagination.pageIndex prop:
screen shot 2018-07-12 at 2 09 00 pm

Repro

You can also view this bug in the EUI docs, under In-Memory Table - Selection, the page buttons are not causing the component to render the appropriate page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug documentation Issues or PRs that only affect documentation - will not need changelog entries
Projects
None yet
Development

No branches or pull requests

1 participant