Skip to content

Added an option to create footers in the table component #862

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

Merged
merged 8 commits into from
Mar 19, 2025

Conversation

francesco-cattoglio
Copy link
Contributor

As per issue #860 this pull request implements two new parameters for the table component: first_row_is_footer and freeze_footers

@lovasoa
Copy link
Collaborator

lovasoa commented Mar 19, 2025

Could we simplify things by introducing a new row-level property _sqlpage_footer and asking that the footer comes in last ?

So that we could do

select 'table' as component;

select col1, col2 from my_table;

select true as _sqlpage_footer, sum(col1) as col1, sum(col2) as col2 from my_table;

@francesco-cattoglio
Copy link
Contributor Author

Sure thing! I actually think that we could even work around the requirement of the footer being the last row, since any table can have multiple <tbody>s and should still work correctly.

@francesco-cattoglio
Copy link
Contributor Author

I implemented the requested change trying to keep the total modifications from the original code as little as possible.
This currently always produces an empty <tbody></tbody> when footer is used but everything renders and works correctly AFAICT.
If you want I can hack around a little more to enforce/ensure that the only correct way to use this is to have the _sqlpage_footer as the last row, and no empty <tbody> sections are created

@lovasoa lovasoa merged commit b074dd1 into sqlpage:main Mar 19, 2025
9 checks passed
@lovasoa
Copy link
Collaborator

lovasoa commented Mar 19, 2025

thank you @francesco-cattoglio !

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.

2 participants