Hiding Table columns based on breakpoints
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
What problem does this feature solve?
Even when the Table component shows an horizontal scroll on small screens, it can be frustrating on tables with many columns. In some cases, just hiding columns that are not important, can help to improve the user experience.
What does the proposed API look like?
The columns can have properties to show or hide them in specific endpoints.
const columns = [{
title: 'Name',
dataIndex: 'name',
key: 'name',
}, {
title: 'Age',
dataIndex: 'age',
key: 'age',
hideOn: ['xs', 'sm'], // <-- Hide this column on small resolutions
}, {
title: 'Address',
dataIndex: 'address',
key: 'address',
visibleOn: ['lg', 'xl'], // <-- Hide this column on larger resolutions (the "mobile first" approach)
}];
const dataSource = [...]
<Table dataSource={dataSource} columns={columns} />
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Automatic Column Hiding using CSS in Responsive Table
In this tutorial, we are going to see how to create a responsive table with automatic column hiding. I used only HTML and...
Read more >Hiding DataTables columns at specific breakpoints
I have two DataTables — one is five columns and the other is four columns — and I'm looking for a way to...
Read more >Hiding columns - FooTable - GitHub Pages
This example shows a table where the first column ID is completely hidden from view using the data-visible column attribute.
Read more >collapse / hide column at breakpoints — DataTables forums
I have a datatable using the responsive add-on , which works great. One column shows a thumbnail image, but I want to hide...
Read more >Table: Column Toggle - jQuery Mobile Demos
The table works by hiding and showing columns based on two inputs: available screen width or by the user checking and unchecking which...
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
I created an alternative solution, based on @yesmeck’s one: https://codesandbox.io/s/nn1y6q1rv4
Thanks for your quick answer @yesmeck!
Still I think this will be a nice feature to use, also to keep consistency with other components that have built-in breakpoint support, like
Layout
,Layout.Sider
andGrid
.