carbon-design-system / ibm-products

A Carbon-powered React component library for IBM Products
https://ibm-products.carbondesignsystem.com
Apache License 2.0
97 stars 137 forks source link

Datagrid Custom sorting does not reset the sort order on refresh of rowdata #6043

Open marinamas opened 1 month ago

marinamas commented 1 month ago

Package

Carbon for IBM Products

Description

Component(s) impacted

Datagrid sorting

Browser

Chrome, Safari, Firefox, Microsoft Edge

@carbon/ibm-products (previously @carbon/ibm-cloud-cognitive) version

"@carbon/ibm-products": "2.48.0",

Suggested Severity

Severity 2 = Aspects of design is broken, and impedes users in a significant way, but there is a way to complete their tasks. Affects major functionality, has a workaround.

Product/offering

NA

CodeSandbox or Stackblitz example

https://codesandbox.io/p/sandbox/datagrid-tooltip-hover-issue-26hqww?file=%2Fsrc%2FExample.js%3A109%2C46

Steps to reproduce the issue (if applicable)

Even though user has a custom logic for onSort written . On refresh of table the sort direction needs to be reset

https://github.com/user-attachments/assets/8e70dc4c-b632-4ad4-8c8f-f83a745611ad

Release date (if applicable)

No response

Code of Conduct

amal-k-joy commented 1 month ago

Hey @marinamas , Can you check if you could achieve this by reseting the sort yourself on refresh functionality.

useEffect(() => {
    datagridState.setSortBy([]);
  }, [data]);
github-actions[bot] commented 3 weeks ago

This issue is stale because it has been open for 7 days with no activity. Remove the stale label or add a comment, otherwise this issue will be closed in 7 days.

github-actions[bot] commented 1 week ago

This issue is stale because it has been open for 7 days with no activity. Remove the stale label or add a comment, otherwise this issue will be closed in 7 days.

marinamas commented 1 week ago

Hi @amal-k-joy , thanks for the update. I have tried this and it works.

You can close this issue

github-actions[bot] commented 1 day ago

This issue is stale because it has been open for 7 days with no activity. Remove the stale label or add a comment, otherwise this issue will be closed in 7 days.