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.

canSort is always true when manualSortBy is true

See original GitHub issue

Describe the bug column.canSort is always true when manualSortBy is true. I’d expect it to default to false for each column (the docs show defaultCanSort should default to false on both the table and column level). Even if I set these explicitly to false on both the table level options and/or the column level options, column.canSort is always true.

codesandbox

Steps To Reproduce Steps to reproduce the behavior:

  1. Go to the codesandbox above
  2. Observe the defaultCanSort is false on both the table options and one of the column options
  3. Observe that all columns can still be sorted

Expected behavior column.canSort respects the defaultCanSort options.

Additional context

I have noticed that disableSorting does work in disabling it. I’m confused as to why there is defaultCanSort and disableSorting - as opposed to defaultCanSort and canSort? Is there a difference I’m not understanding? And if defaultCanSort is false, why is that not respected?

And why is it “default” canSort - this makes me think it’s the default for an uncontrolled prop/state and that canSort could change… is that possible?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:5

github_iconTop GitHub Comments

2reactions
Billy-commented, Sep 3, 2020

@Billy- Column properties should be: disableFilters, disableSortBy.

The docs also show table and column level props for defaultCanSort - this is what my issue is about - they don’t seem to work.

I don’t want to repeat disableSortBy on every column - I want to default canSort to false and then only set it to true on a column where I want to support it.

1reaction
shuheitachikawacommented, Jan 5, 2022

is this problem fixed? I am facing same problem…

Read more comments on GitHub >

github_iconTop Results From Across the Web

canSort is always true when manualSortBy is true · Issue #2599
Describe the bug column.canSort is always true when manualSortBy is true. I'd expect it to default to false for each column (the docs...
Read more >
Sorting | TanStack Table Docs
Sorts by text/string values without case-sensitivity. Faster, but less accurate if your strings contain numbers that need to be naturally sorted.
Read more >
How to: React Table with Sort - Robin Wieruch
In this tutorial, I want to show you how to use React Table Library with its useSort plugin to implement user sorting.
Read more >
react-table - UNPKG
paddingLeft),\n right: parseInt(style. ... forEach(column => {\n const {\n accessor,\n canSort: defaultColumnCanSort,\n disableSortBy: columnDisableSortBy ...
Read more >
SortingOptions | React-Table UI Docs
Enable sorting for all columns, regardless if they have a valid accessor. ... If true, the un-sorted state will not be available to...
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