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.

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:closed
  • Created 5 years ago
  • Reactions:7
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

10reactions
eduludicommented, Jun 14, 2018

I created an alternative solution, based on @yesmeck’s one: https://codesandbox.io/s/nn1y6q1rv4

3reactions
eduludicommented, Jun 14, 2018

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 and Grid.

Read more comments on GitHub >

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

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