Scrollbars are rejected in MaterialUI Tables
See original GitHub issueWhen used in a material UI TableBody, it seems that MaterialUI rejects anything that may alter their table’s architecture throught the DOM. Material UI forbids using anything other than TableHeader or TableBody as Table children, and any <div> inside of TableBody or Table Header (per HTML5 standars, this is not permitted either)
<Scrollbars> render as a div.
Is there a way to assign Scrollbars to the TableBody without using the <Scrollbars> so that way the Table architecture is unchanged?
Here is the code
`<TableBody
displayRowCheckbox={this.state.showCheckboxes}
deselectOnClickaway={this.state.deselectOnClickaway}
showRowHover={this.state.showRowHover}>
<Scrollbars //not permitted. it renders as a <div>
autoHide={false}
style={ScrollBarsStyle}>
{tableData.map( (row, index) => (
<TableRow key={index}>
<TableRowColumn>{row.name}</TableRowColumn>
<TableRowColumn>{row.type}</TableRowColumn>
<TableRowColumn>{row.owner}</TableRowColumn>
</TableRow>
))}
</Scrollbars>
</TableBody>`
UPDATE The only way it can work is by adding the entire table inside the Scrollbars tags. But it disables the fixedHeader.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:7
Top Results From Across the Web
material ui table horizontal scroll - Stack Overflow
On my CodeSandbox I get a horizontal scrollbar. Can you post a CodeSandbox with a version of your code that shows the problem?...
Read more >Using React-Virtualized InfiniteLoader, Autosizer, and Table ...
Here are my two functions. In the parent component. getRowsFromServer = ({startIndex, stopIndex }) => { return new Promise((resolve, reject) => ...
Read more >How to Use WebKit with Material-UI - YouTube
I'll break it down quickly and easily here as we style the horizontal and vertical scrollbar on a Material-UI Table.
Read more >material-table/Lobby - Gitter
@Domino987 Haha, I cannot reproduce it in a code sandbox. For some reason in the sandbox it's adding a horizontal scrollbar on the...
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
This can be accomplished by using two material-ui tables. One for the header and one for the rows.
@justinmasse, @carlosafw just put both tables inside a horizontally scrollable div