DataTable: custom sorting and custom filtering not working together

UI Components for React
Post Reply
Master_T
Posts: 14
Joined: 13 Dec 2021, 11:57

28 Jan 2022, 13:36

Hi

I have a DataTable where I implemented a custom sorting function like this:

Code: Select all

sortField(e: ColumnSortParams) {
    let rows = [...this.state.rows]
    rows.sort((a, b) => {
        //my custom sorting logic
    });

    return rows;
}
This works, however it seems to interfere with custom filtering.
In particular, I have a custom filterFunction on some columns, and:
  • If the table is filtered and I sort a column, the filters gets lost and all the data is displayed
  • If the table is sorted and I filter a column, the filter doesn't get applied
Any way around this?

Master_T
Posts: 14
Joined: 13 Dec 2021, 11:57

02 Mar 2022, 11:31

Still haven't found a solution to this. Is there really no guide/example out there on how to implement this properly?

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests