react-bootstrap-table2 icon indicating copy to clipboard operation
react-bootstrap-table2 copied to clipboard

sortFunc is not called

Open jchirschy opened this issue 3 years ago • 1 comments

I confirm in [email protected], 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 [email protected]. Issue related : #1340

Did I miss something ?

Thanks for you help.

jchirschy avatar Dec 02 '21 15:12 jchirschy

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

Ymbere avatar Jan 10 '22 22:01 Ymbere