I am using ag-grid with react; it has an event
sortChanged={sortChanged}
According to this documentation http://54.222.217.254/javascript-grid-events/#sort-filter
But in my case it doesn't get called, I am not sure why.
What i can see from this Link is that it is working in angular.
I tried to follow different syntax and went through its complete documentation but no luck.
This is my forged punker where i just want the alert hi just to know that user clicked to sort: https://plnkr.co/edit/48MYV18mpAAuK27L?preview
I am trying like this:
<AgGridReact
defaultColDef={{ sortable: true }}
onGridReady={onGridReady}
rowData={rowData}
sortChanged={sortChanged}
>
and using it like this:
const sortChanged = (e) => {
alert("hi")
console.log(e)
}
Try one of these:
const onSortChanged=(e: AgGridEvent)=> {
e.api.refreshCells();
}
or
const onSortChanged=(e: AgGridEvent)=> {
e.api.redrawRows();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.