Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TreeTable: Custom sorting (for example from an API) needs better docs #6083

Open
SpajicM opened this issue Mar 4, 2024 · 9 comments
Open
Labels
Type: Bug Issue contains a defect related to a specific component.

Comments

@SpajicM
Copy link

SpajicM commented Mar 4, 2024

Describe the bug

Hi, I'm using onSort function to make an API call for sorting, but when onSort function is used, original icon highlight and toggling between ASC and DESC is lost.

Expected:

image

  • Highlight icon showing up
  • Click on arrows toggling the state between ASC and DESC (0 and 1)

Actual:

  • No indicator of sort being enabled
  • sortOrder in event is always 1

image

image

Reproducer

https://stackblitz.com/edit/vqw5gi-vnizjy?file=src%2FApp.jsx

PrimeReact version

9.5.0

React version

17.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

@SpajicM SpajicM added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Mar 4, 2024
@melloware
Copy link
Member

Duplicate of #6115 which has a reproducer so subscribe to that ticket please.

@melloware melloware closed this as not planned Won't fix, can't repro, duplicate, stale Mar 10, 2024
@melloware melloware added Resolution: Duplicate Issue has already been reported or a pull request related to same issue has already been submitted and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Mar 10, 2024
@SpajicM
Copy link
Author

SpajicM commented Mar 10, 2024

@melloware I have checked the other ticket - it's not the same issue. This one is about table-level "onSort" prop, the other one is column-level "sortFunction", and the behavior problem is different.

I'll try to put together a reproductor example ASAP. Thanks!

@melloware
Copy link
Member

ok if you add a reproducer i can re-open this one.

@SpajicM
Copy link
Author

SpajicM commented Mar 11, 2024

@melloware Added reproductor and more details to description of the issue! Thank you.

@melloware melloware reopened this Mar 11, 2024
@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Resolution: Duplicate Issue has already been reported or a pull request related to same issue has already been submitted labels Mar 11, 2024
@github-actions github-actions bot added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Mar 11, 2024
@melloware melloware removed the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Mar 11, 2024
@KirilCycle
Copy link
Contributor

@melloware Hello! Can you assign me please ?

@KirilCycle
Copy link
Contributor

@SpajicM The TreeTable works fine, you just need to manually connect the states to the TreeTable using the 'sortOrder' and 'sortField' properties:
BDF4CF59-4811-4A59-B121-3261806C5F84_1_201_a

@SpajicM
Copy link
Author

SpajicM commented May 7, 2024

@KirilCycle oh, thanks! Is this documented anywhere or I've missed it?

TreeTable's main page only explains sortable and sortMode props, while API page for sortOrder says: "Order to sort the data by default.", which sounds like it's only for setting prefered initial order, not that it should be used in combination with onSort function.

@KirilCycle
Copy link
Contributor

@KirilCycle oh, thanks! Is this documented anywhere or I've missed it?

Well, I didn't see it in the documentation, only descriptions of specific props

@SpajicM SpajicM changed the title TreeTable: Sort toggle when using custom onSort function TreeTable: Custom sorting (for example from an API) needs better docs May 7, 2024
@KirilCycle
Copy link
Contributor

KirilCycle commented May 7, 2024

I noticed that vueprime TreeTable doesn't need to pass options manually, I think we should modify the current TreeTable to have similar behaviour, as even props description says that 'sortField' and 'sortOrder' should be used at initial render

StackBlitz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants