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.

A component inside table headers slot

See original GitHub issue

Steps to reproduce

Hi, I wanted to put a component inside datatables headers slot like this:

<template slot="headers" scope="props">
  <my-component />
</template>

my-component contains all th tags wrapped in a tr tag which is the root.

<tr>
  <th>blah</th>
</tr>

but by doing so vuetify wraps my component in another tr which messes up the markup, the result is a tr containing a tr

<tr>
  <tr>
    <th>blah</th>
  </tr>
</tr>

this is due to this line of code: head.js:13

children = row.length && row[0].tag === 'tr' ? row : this.genTR(row)

when using a component, the tag property is assigned the component’s name thus, a new tr is generated.

is there a workaround?

Thank you.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
nekosaurcommented, Aug 8, 2017

That’ll have to end up being user error I think. You can only have one root element in vue templates anyway, so a user would have to do something like

<template>
  <div>
    <td></td>
    <td></td>
  </div>
</template>

which isn’t valid html in a table anyway.

0reactions
lock[bot]commented, Apr 16, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please direct any non-bug questions to our Discord

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tables with Two Headers | Web Accessibility Initiative (WAI)
This page covers tables that have a simple row header and a simple column header. In such tables, the relationship between the headers...
Read more >
How can you customize all elements in a table header?
It is possible to loop the headers to make all capitalize. here is the working codepen: https://codepen.io/chansv/pen/gOaRWQb?editors=1010
Read more >
Table | Components - BootstrapVue
These titles will be displayed in the table header, in the order they appear ... of the table-colgroup slot will be placed inside...
Read more >
<th>: The Table Header element - HTML - MDN Web Docs
The <th> HTML element defines a cell as header of a group of table cells. The exact nature of this group is defined...
Read more >
Data table component - Vuetify
The show-select prop will render a checkbox in the default header to toggle all rows, and a checkbox for each default row. You...
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