How to implement a custom sort in my use case?
How to implement a custom sort in my use case?
ambrosehundal
Posts: 2Questions: 1Answers: 0
I have a table for which I am using datatables to sort. One of the table columns is called "status" and it has three possible values - pending, rejected and approved.
Right now I can sort by rejected and approved. I would like to have a custom sort where I could sort by "pending" . How should I go about this?
This discussion has been closed.
Answers
Hi @ambrosehundal ,
You could either use
columns.render
or create a custom sorting plugin,Cheers,
Colin
Hi Colin, would this still allow me to sort by "rejected" and "approved" along with sorting by "pending' all three?
I am not sure what I am doing wrong
the column is called approval_status from the row that is coming from the db. My table column header is called "Status". Which one am I supposed to use?
You would use the name in the JSON, which I suspect would be
approval_status
. We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.Cheers,
Colin