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.

Custom sort for only once column

See original GitHub issue

Feature request:

I’m looking for a way to add manual sort to only one column in DataTable.

Currently, setting custom sort overrides sorting for all columns. For my use case, however, I only need to override functionality for one column.

One of my columns holds links and the table doesn’t seem to know how to handle that, so I’d like to modify sorting for just this column and leave the rest as is since they work just fine.

Using

"carbon-components": "^9.8.0",
"carbon-components-react": "6.46.2"

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
3dfostercommented, Oct 1, 2019

Hi 👋 thank you entering this issue! Just one question - Have you tried setting false to isSortable prop in <TableHeader>? Something like:

<TableHeader {...getHeaderProps({ header })} isSortable={false}>
  {header.header}
</TableHeader>

Would this prevent the other columns from using the default sort method?

1reaction
asudohcommented, Feb 19, 2019

Hi 👋 thank you entering this issue! Just one question - Have you tried setting false to isSortable prop in <TableHeader>? Something like:

<TableHeader {...getHeaderProps({ header })} isSortable={false}>
  {header.header}
</TableHeader>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Sort data in a table - Microsoft Support
Select Home > Sort & Filter. ... Or, select Data > Sort. ... Select an option: ... Custom Sort - sorts data in...
Read more >
Excel SORTBY function - custom sort with formula - Ablebits
See how to use the SORTBY function in Excel to sort data by a custom list, in random order, by text length, and...
Read more >
Pivot Table Sorting Trick - Microsoft Tips and Codes
A quick way to sort columns by a custom list in a pivot table. ... Once in a while, we have lists that...
Read more >
Custom Sorting in SQL order by clause? - Stack Overflow
If you have only a single value that has to sort on top, you can ORDER BY an expression that maps that value...
Read more >
Power Apps SortByColumns and Sort function with a custom ...
I also learned a special trick for SortByColumns where you can have a custom sort order. And at the end we have some...
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