sortFunction in Column doesn't work
I have defined in my html the next column inside dataTable: <p-column field="auxRequestDate" header="Test1" sortable="true" (sortFunction)="orderDate($event)">
Where the sortfunction is simple like orderDate(event) { console.log(event); }
But never enter in the function, because I have any message in console when debugging, so what I am doing wrong?
Thankyou
I am going to answer myself, my problem was that in the field "sortable" we need to write "custom", anyway doesn't work the sortFunction
I have the the same issue on the latest version 1.0.0-beta.16
My solution was: HTML (code): <p-column field="auxRequestDate" header="datetime_request" sortable="custom" (sortFunction)="orderDate($event)" TS (code): orderDate(event) { if (event.field == "auxRequestDate") { if (event.order == 1) this.dataGrid.sort((a, b) => { return (a["requestDate"]) - (b["requestDate"]); }); else this.dataGrid.sort((a, b) => { return (b["requestDate"]) - (a["requestDate"]); }); } }
I can't replicate with PrimeNG 4.0.1, please drop a comment if issue still persists.