question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Table] Possibility to add html in between table rows ?

See original GitHub issue

Bug, 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:closed
  • Created 6 years ago
  • Reactions:12
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

9reactions
willshowellcommented, Jul 27, 2017

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.

8reactions
Lakstoncommented, Jul 22, 2017

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found