[Table] Body, Header and Footer rendered in separate tables
See original GitHub issueProblem description
Table header, body and footer rendered in separate tables.
From the source:
<div style={prepareStyles(Object.assign(styles.tableWrapper, wrapperStyle))}>
{headerTable}
<div style={prepareStyles(Object.assign(styles.bodyTable, bodyStyle))} ref="tableDiv">
<table className={className} style={mergedTableStyle} ref="tableBody">
{inlineHeader}
{inlineFooter}
{tBody}
</table>
</div>
{footerTable}
</div>
Versions
- Material-UI: 0.15.0
Description
When setting style for a column of table header and the same exact style is not specified in the corresponding table body column, the appearance breaks.
Rendering the header, body and footer separately loses the ability of letting the browser keep the columns across these sections well aligned.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:9
- Comments:10 (7 by maintainers)
Top Results From Across the Web
[Table] Body, Header and Footer rendered in separate tables
Problem description Table header, body and footer rendered in separate tables. From the source: {headerTable}
Read more >Tables: Columns, Headers, and Footers
Headers and Footers ... thead , tfoot and tbody allow you to separate the table into header, footer and body, which can be...
Read more ><tbody>: The Table Body element - HTML - MDN Web Docs
This lets you divide the rows in large tables into sections, each of which may be separately formatted if so desired. If not...
Read more >Table rendered as two separate table may confuse screen ...
DataTables has to split the header, body and footer into separate tables in order to be able to have the header not move...
Read more >Tables in HTML documents
Table rows may be grouped into a head, foot, and body sections, (via the THEAD , TFOOT and ... User agents must know...
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 Free
Top 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
I also don’t understand why not using the browser table renderer is considered a feature. Auto-expandable cells based on content is a must IMO. The
<Table>
component is useless with real content otherwise. I secretly hoped that 0.16 would fix this, but it appears that it doesn’t.For instance, in admin-on-rest, look at how the ‘id’ column takes too much space and the "post’ column is too narrow:
Fixing this requires way too much boilerplate on userland.
Can you explain why this is a feature? If not, can we help fixing the bug?
@fzaninotto I had the same width issue…
<Table style={{ tableLayout: 'auto' }} ...>
came to the rescue, incase someone else has the same problem. ButfixedHeader={false}
is required on<Table>
, otherwise the columns want be aligned. So<Table style={{ tableLayout: 'auto' }} fixedHeader={false}>