I am using ag-grid-react and would like to sortable columns in it.
When I put enableSorting=true on , it enables sorting on all the columns. I don't want all columns to be sortable and instead would like sorting to be driven from the columnDef.(E.g sort the column only if its respective columnDef contain sortable=true.
Attaching the sample and columnDef with codesandbox link
<AgGridReact
columnDefs={this.state.columnDefs}
enableColResize={true}
onGridReady={this.onGridReady.bind(this)}
rowData={this.state.rowData}
enableSorting={true}
/>
columnDefs: [
{
headerName: "Athlete",
field: "athlete",
width: 150,
suppressSizeToFit: true
},
{
headerName: "Age",
field: "age",
width: 90,
minWidth: 50,
maxWidth: 100
},
{
headerName: "Country",
field: "country",
width: 120
},
{
headerName: "Year",
field: "year",
width: 90
},
{
headerName: "Date",
field: "date",
width: 110
},
{
headerName: "Sport",
field: "sport",
width: 110
},
{
headerName: "Gold",
field: "gold",
width: 100
},
{
headerName: "Silver",
field: "silver",
width: 100
},
{
headerName: "Bronze",
field: "bronze",
width: 100
},
{
headerName: "Total",
field: "total",
width: 100
}
],
Please refer : https://codesandbox.io/s/jz317zpo43
Please suggest what needs to be added.