-
Notifications
You must be signed in to change notification settings - Fork 79
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
How to freeze columns in reactable #19
Comments
You can freeze columns using the I think it'd be nice to build this into reactable in the future, but for now, you'll have to add some likely-messy CSS yourself. I've created some examples of single/multiple sticky columns here: Also note IE11 doesn't support |
Is there a way to freeze the checkbox column too? As a simple example, when using a selectionId you will see the checkbox column does not stick:
|
@analytichealth I just added the ability to customize the row selection column to make that easier: https://glin.github.io/reactable/articles/examples.html#customize-the-selection-column You can now add inline styles or classes to the selection column like this: reactable(
MASS::Cars93,
selection = "multiple",
columns = list(
.selection = colDef(
style = list(position = "sticky", left = 0, background = "#fff", zIndex = 1),
headerStyle = list(position = "sticky", left = 0, background = "#fff", zIndex = 1)
)
)
) Here are some examples of freezing the selection column: https://glin.github.io/reactable/articles/sticky-columns-selection.html. The only other tricky part is that selection columns have a different, undocumented default width (36px), so I'd recommend setting the width explicitly, in case the default ever changes. |
Sticky columns are now built into reactable in the dev version: It should be much easier to do now, as you don't have to worry about the column widths, z-index, or background anymore: reactable(
MASS::Cars93,
columns = list(
Manufacturer = colDef(sticky = "left"),
Make = colDef(sticky = "right")
)
) There are a couple examples here: https://glin.github.io/reactable/articles/examples.html#sticky-columns And an example of a sticky selection column here: https://glin.github.io/reactable/articles/examples.html#customize-the-selection-column |
if we need to freeze 5 left most column and provide a horizontal scroll bar afterwards, how do we do that with reactable?
The text was updated successfully, but these errors were encountered: