-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Footer in md-table #6570
Comments
This will be possible when we introduce a |
Hey @andrewseguin, just noticed #5887 is closed. I'm still getting my head around how the cdk-table works, so I was wondering if there will be documentation on how to use the new |
@patoncrispy untested shot in the dark, but I think something like this would work <md-row *cdkRowDef="let row; columns: itemColumns;"></md-row>
<md-row *cdkRowDef="let row; columns: totalColumns; when:isLastRow"></md-row> itemColumns = ['valA', 'valB'];
totalColumns = ['totalA', 'totalB'];
isLastRow = (data, index) => this.completeDataset.length === index - 1;
// This is obviously pseudo code, but make sure you append a final item
// to your data source array that contains the data needed for the last row.
this.dataSource.use([...this.completeDataset, { totalA: 123, totalB: 234 }]); |
Thanks, @willshowell. That makes sense! |
@willshowell Interesting, though I have not been able to get something like you mentioned working. Would anyone have a more complete working example? |
Check out the duplicate issue for more details, we'll track this there |
@andrewseguin Without totals I can't use the datatable for my projects. Is there any workaround until this feature is implemented? |
@pantonis The solution depends on the type of UX you are looking for. Do you have pagination? Is the footer meant to be sticky? |
Yes it has pagination and needs to be sticky |
Here's one workaround that places a row in your data that creates a separate https://stackblitz.com/edit/angular-rkmynk?file=app%2Ftable-basic-example.ts |
Do you think this is something that will be embedded in datatable's functionality natively? |
Thanks for the example by the way. You guys are doing great job! |
I think it'll be something we add in but it's not as high priority as other features for the table, so it might be some time. Thanks for the support, hope the example helps out a bit |
@andrewseguin The workaround you posted only works when there is no paginator. When paginator is added in table, totals row is not shown. |
With the workaround, also when sorting the totals pop to the top :/ |
Good news, we have a PR open for this :) #10330 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug, feature request, or proposal:
Feature Request.
What is the expected behavior?
Allow developers to be able to specify table footer content.
What is the current behavior?
This feature is not available (AFAIK).
What is the use-case or motivation for changing an existing behavior?
A lot of my tables work with numbers for which it would be great to be able to provide totals for.
The text was updated successfully, but these errors were encountered: