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 ignores initial pagination props #1794

Closed
igoristic opened this issue Apr 4, 2019 · 4 comments
Closed

EuiInMemoryTable ignores initial pagination props #1794

igoristic opened this issue Apr 4, 2019 · 4 comments

Comments

@igoristic
Copy link

igoristic commented Apr 4, 2019

This isn't really related to #1007, since this is affecting initial props. So, if the component starts out with anything other than its default/initial pagination prop eg:

const pagination = {pageIndex: 2, pageSize: 10};

<EuiInMemoryTable
  pagination={pagination}
  ...
/>

I think it's because getInitialPagination does not return anything if pagination does exist:
https://github.com/elastic/eui/blob/master/src/components/basic_table/in_memory_table.js#L95

Maybe reimplementing it to something like this might fix it:

const getInitialPagination = (pagination) => pagination || {};
@chandlerprall
Copy link
Contributor

I'm unable to replicate this issue, can you provide a demo of the bug (e.g. with https://codesandbox.io)?

For testing, I've added

pagination={{ initialPageSize: 4, pageSizeOptions: [2, 4, 8] }}

to the example at src-docs/src/views/tables/in_memory/in_memory.js and get this result:

in memory table initial pagination

@igoristic
Copy link
Author

Please try it with:

pagination = {pageIndex: 2, pageSize: 10};

In some cases we want to initiate/start a table at page 3 for example.

This relates to elastic/kibana#32663, unfortunately angular does not update react components but instead redraws them anytime there is a change from the scope

@chandlerprall
Copy link
Contributor

Ah, gotcha. I mis-read your pageIndex: 2 key/value.

@chandlerprall chandlerprall self-assigned this Apr 4, 2019
@chandlerprall
Copy link
Contributor

re: https://github.com/elastic/kibana/pull/34565/files#diff-f5c2be5f354e6067ab8d71ff231e2077

I can't see us changing the names of these props (so the mapping in the above PR will need to remain), but it does make sense to support an initial page index.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants