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

[TablePagination] Allow using it anywhere #8525

Merged
merged 1 commit into from
Oct 4, 2017

Conversation

leMaik
Copy link
Member

@leMaik leMaik commented Oct 3, 2017

This PR modifies the TablePagination so that it can be used everywhere. I also modified the TypeScript typings to include the TableCell props and styles which might become handy for customizing the pagination (especially the component prop needs to be changed to div when not using the pagination inside a table).

I'm not sure whether the component should be renamed to Pagination and TablePagination should become a tiny wrapper around that where component is set to td? 🤔

Breaking change

             <TableFooter>
-              <TablePagination
-                count={data.length}
-                rowsPerPage={rowsPerPage}
-                page={page}
-                onChangePage={this.handleChangePage}
-                onChangeRowsPerPage={this.handleChangeRowsPerPage}
-              />
+              <TableRow>
+                <TablePagination
+                  count={data.length}
+                  rowsPerPage={rowsPerPage}
+                  page={page}
+                  onChangePage={this.handleChangePage}
+                  onChangeRowsPerPage={this.handleChangeRowsPerPage}
+                />
+              </TableRow>
             </TableFooter>

Closes #8520

@leMaik
Copy link
Member Author

leMaik commented Oct 3, 2017

I don't get it… The unit tests run fine on my machine. 😮

@oliviertassinari
Copy link
Member

I'm not sure whether the component should be renamed to Pagination and TablePagination should become a tiny wrapper around that where component is set to td? 🤔

@leMaik I have some doubt about the validity of using the TablePagination component outside of a Table. I don't think that we should be supporting it, but I'm not sure we should embrace it.
I think that keeping the current name is was make more sense. Still, if later on, we also move the TableCell outside of the component, then I agree, Pagination would make more sense.

I don't get it… The unit tests run fine on my machine. 😮

@leMaik It should be good now :).

@oliviertassinari oliviertassinari added component: table This is the name of the generic UI component, not the React module! PR: accepted labels Oct 3, 2017
@mui mui deleted a comment from leMaik Oct 3, 2017
@oliviertassinari
Copy link
Member

@leMaik I have been making a mistake the first time. It should be better now.

@leMaik
Copy link
Member Author

leMaik commented Oct 3, 2017

@oliviertassinari Uhm… No it isn't? If you set colSpan but component is 'td', colSpan will still be ignored. colSpan is not included in other, so it will be missing entirely in that case.

@leMaik
Copy link
Member Author

leMaik commented Oct 3, 2017

I have some doubt about the validity of using the TablePagination component outside of a Table. I don't think that we should be supporting it, but I'm not sure we should embrace it.

@oliviertassinari Well, there seem to be people who would like to use TablePagination outside of tables, though. But it's just naming, so that can wait. 👍

@oliviertassinari
Copy link
Member

@leMaik You are right. It's time for me to sleep 😴 .

@oliviertassinari oliviertassinari self-assigned this Oct 4, 2017
@oliviertassinari oliviertassinari force-pushed the pagination-everywhere branch 2 times, most recently from 1ee0e9d to 034cb9c Compare October 4, 2017 15:44
@oliviertassinari oliviertassinari merged commit 2caf37b into mui:v1-beta Oct 4, 2017
@leMaik leMaik deleted the pagination-everywhere branch October 4, 2017 16:00
@daiky00
Copy link

daiky00 commented Dec 5, 2018

Any Samples Showing how to implement this without the table?

@oliviertassinari
Copy link
Member

oliviertassinari commented Dec 6, 2018

@daiky00 What do you mean by a sample, where is this not working?

@sbiales
Copy link

sbiales commented Jan 29, 2020

I would also appreciate a sample of how to use this. The example from issue #14867 does not work and I found #8520 as well but the "sample" at the bottom fails to show how to use this outside of a table, like with a List of ListItems. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change component: table This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants