-
Notifications
You must be signed in to change notification settings - Fork 137
Table footer! #860
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
Comments
Hello ! I think I'm missing something. Why is there anything special to do to render a footer; why couldn't the footer be a normal table row ? select 'table' as component;
select product, quantity, price from bill_items where id=$id;
select 'total' as product, sum(quantity) as quantity, sum(price) as price from my_table where id=$id; -- this is the "footer"; it's just a normal row at the end of the table |
Hi!
|
You can test on the example https://sql-page.com/component.sql?component=table (0.34 version) On the 33.1, I use a workaround to keep sticky footer with a normal row with a specific value in one cell and opacity:0 to hide this value. Second solution, use a second table (no sort, no filter, only a normal row as footer row) with the same columns name (to have alignment). You can active sort option to have exactly same alignment with table above. Maybe the first or the second solution works for you. |
With release of version 0.34, the sample on the documentation works well. |
What are you building with SQLPage ?
Still building the same reporting tool with big numbers in a table 😄
What is your problem ? A description of the problem, not the solution you are proposing.
Since my tables contain a lot of data, it would be nice if it was possible to create a footer at the end of the table with some computed values (e.g. totals or averages)
Describe the solution you'd like
I have already hacked a solution by (ab)using the fact that in HTML you can have a
<tfoot>
before a<tbody>
, and yet everything will be rendered correctly in the end. The solution currently works like this:{{#each_row}}
block in handlebars it is easy to know if this is the first row, but it is not possible to know if this is the last onefirst_row_is_footer
, so that inside the handlebars template the first row of data is used to build a<tfoot>
tag. There are a fewifs
here and there to make sure the rendering is still correct when no footer is present.select
that shows all table contents, I just do aselect
with somesum()
s from the same temporary table, so that the code duplication in my SQL files is very little.freeze_footers
top level parameter to have the footer sticky as well!toLocaleString
function as the table body. For me it is a solid yes, but perhaps in some situations one might not want it, and as far as my changes goes this cannot be choosen user-sideAdditional context
I have to clean up some code, and perhaps write an example, but if you are interested I might be able to open a pull request by tomorrow!
The text was updated successfully, but these errors were encountered: