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

Add support for more header rows #769

Closed
wants to merge 12 commits into from
Closed

Conversation

johnknoop
Copy link
Contributor

@johnknoop johnknoop commented Aug 20, 2024

Issues addressed in this pr:

Support for more header rows

They are now rendered as part of the thead so that they stick when scrolling. It also means they are properly repeated at the top of each page when printing. (Although we seem to have other issues with printability of StandardTable: most of the rows are just blank, which I'm guessing is because of virtualization).

A thought: perhaps we should also offer control over how the primary header row is rendered? It is a little weird that you can pass a render function for the second header row but not for the first.

Simplify code by making entire thead sticky

Adding more header rows caused me to have to keep track of the number of preceding rows in order to compute the proper vertical offset for the top position (the getTopPosition function). But nowadays we can make the entire thead element sticky, so we don't need to set it on the th elements anymore. This gets rid of a bunch of javascript logic, and also makes it easier to have multiple header rows sticky, since we don't need to think about offset from preceding header row.

if (validationError) {
return <ErrorScreen text={validationError.message} />;
}

const showAdditionalHeaderRow = Object.values(config.columns).some(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like a hack. Do you have an idea for a cleaner way?

@johnknoop johnknoop closed this Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant