Skip to content

DataTable - Multiple sort won't work when any column has a sortFunction defined. #359

Description

@github-actions

There is no guarantee in receiving an immediate response in GitHub Issue Tracker, If you'd like to secure our response, you may consider PrimeReact PRO Support where support is provided within 4 business hours

I'm submitting a ... (check one with "x")

[ x] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://forum.primefaces.org/viewforum.php?f=57

Codesandbox Case (Bug Reports)
https://codesandbox.io/s/primereact-test-forked-bq3q5?file=/src/index.js

When multiple column sorting is used and a sortfunction is supplied for a column, multiple sort does not work.

Current behavior

  • Datatable is sorted by multiple columns but does not use custom sort function(s) defined if the first sort column has not a custom sort funtion.

  • Datatable is sorted by only the custom sort function of the first sort column if the first sort column has a custom sort funtion.

Expected behavior
Datatable should be sorted by multiple columns whether sortfunction is defined for sort columns or not.

The problem is that the contract of the sortFunction does not allow us to do compare two rows of the data, instead we can only sort all the data. The Column component needs to have a propetry like compareFunction(data1, data2, sortOrder).


Original issue:
primefaces/primereact#1980

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions