react-bootstrap-table/react-bootstrap-table2

sortFunc is not called

Opened this issue · 1 comments

I confirm in react-bootstrap-table-next@4.0.3, onSort and sortFunc aren't working.
For example, in columns definition, something like that does not logged anything to console :

{
  dataField: 'id',
  text: 'Product ID',
  sort: true,
  sortFunc: (a, b, order, dataField, rowA, rowB) => {
    console.log('sortFunc');
    if (order === 'asc') {
      return b - a;
    }
    return a - b; // desc
  },
  onSort: (field, order) => {
    console.log('onSort');
  }
}

It used to work in react-bootstrap-table-next@3.3.3.
Issue related : #1340

Did I miss something ?

Thanks for you help.

Hi @jchirschy, the sort functions seem to be working properly, I have created an example so you can test it.
Check the console and you can notice the functions are been called.

Here is the version that I'm using.

react-bootstrap-table-next: 4.0.3
react-bootstrap-table2-filter: 1.3.3
react: 17.0.2
react-dom: 17.0.2
react-scripts: 4.0.0

Hope it helps.

Edit cocky-hooks-pcoqe