glin / reactable

Interactive data tables for R
https://glin.github.io/reactable
Other
627 stars 80 forks source link

Page Size Adjust to Container Size #302

Open sprucemister opened 1 year ago

sprucemister commented 1 year ago

Is this possible?

Would be great cause I have users of a shiny app with different size screens https://stackoverflow.com/questions/46759715/reacttable-changing-pagesize-based-on-container-height-552

glin commented 1 year ago

Hi, can you be more specific on what you'd like to see with the page size control? Do you mean like being able to reduce the number of page number buttons from the default 6 to something lower, and depending on the table width? Or being able to change pagination types, e.g. from page numbers to the simple prev/next buttons?

Right now, neither of those are possible and pagination is completely fixed. However, it's still somewhat responsive to smaller screens, as the page buttons will wrap to the next row if they don't fit. If you don't want that wrapping behavior, then the best solution would probably be to use the simple pagination type.

sprucemister commented 1 year ago

Thanks for the comment Greg, I guess I meant like that the number of rows per page would automatically be set based on the height of the container that the table is in if that makes sense?

I have an app where some users have different screen sizes and so I can either make the height smaller and rows per page to 10 for the users with smaller screens, which leaves a good bit of white space for the users with larger monitors

Or I could set my page size to 13 which will eliminate the white space and be good for the users with larger monitors.

Of course I can just give everyone the page size options of 10 or 13 but it would be cool if it didn't take that extra legwork from the user