I have created a table with react bootstrap table next and I try to use the defaultSorted features. Here is an example from the doc:
import BootstrapTable from 'react-bootstrap-table-next';
const columns = [{
dataField: 'id',
text: 'Product ID',
sort: true
}, {
dataField: 'name',
text: 'Product Name',
sort: true
}, {
dataField: 'price',
text: 'Product Price',
sort: true
}];
const defaultSorted = [{
dataField: 'name',
order: 'desc'
}];
<BootstrapTable
keyField="id"
data={ products }
columns={ columns }
defaultSortDirection="asc"
/>
What I don't understand is where to use the defaultSorted constant? Should I add it to one of my column or in the bootstraptable? I have tried different solution and none of them seems to works. Thank you for your help.