[Table] Possibility to add html in between table rows ?
See original GitHub issueBug, feature request, or proposal:
More of a question if this is possible or not.
What is the expected behavior?
I would like to be able to add markup below each row so I can show it conditionally on row click so it would behave like an accordion. Additional infos would be contained in a div with an ngIf and triggered on row click.
To illustrate what I am trying to achieve :
| Firstname | Lastname | email |
| <div *ngIf="row is clicked">Additional Content</div> |
| Firstname | Lastname | email |
| <div *ngIf="row is clicked">Additional Content</div> |
What is the current behavior?
The cdk docs states Any content placed inside of the header row or data row template will be ignored, as the rendered content of the row comes from the cell templates described above.
so it seems that what I’m trying to achieve is not possible.
What are the steps to reproduce?
As stated in the docs any attempt to add markup between the md-row
tags will be ignored.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:12
- Comments:11 (4 by maintainers)
Top Results From Across the Web
insertion of an html tag between rows of a table - Stack Overflow
The only valid ways to group table rows are thead , tbody , and tfoot elements. The normal way to group data rows...
Read more >Is it possible to add rows to html table in the code-behind?
Can I add rows to an html table programmatically? You sure can. Just make sure you table element has the runat="server" attribute set....
Read more >How to Add Space Between Rows in the Table - W3docs
The space between two rows in a <table> can be added by using the CSS border-spacing and border-collapse properties. The border-spacing property is...
Read more >HTML DOM Table insertRow() Method - W3Schools
The insertRow() method creates an empty <tr> element and adds it to a table. The insertRow() method inserts the new row(s) at the...
Read more ><tr>: The Table Row element - HTML - MDN Web Docs - Mozilla
The <tr> HTML element defines a row of cells in a table. The row's cells can then be established using a mix of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here is a very brittle example of how you might achieve this:
https://plnkr.co/edit/ZL6OnWwVmOCPYetp96XX?p=preview
However I do wish that this was a little easier. @jelbourn could you comment on whether this is the best approach? As @Lakston alluded to, once people in the community understand how to work with the table, SO/Gitter questions will actually get correct answers. But for now, there’s a lot of confusion out there, and certainly no information regarding this particular topic.
We should ask people who probably have no idea instead of the people who actually made and know the tool if something is possible ? That doesn’t sound great.