Search code examples
jquerydatatablesyadcf

yadcf plugin and jQuery Datatables filter ordering


I am using jQuery Datatables with the yadcf plugin to filter on certain columns and wondered what approach I should use to get the column "Period" to display the filter in the correct date order.

I can get the Period column to sort OK using a hidden span and a full date i.e. 01/12/2019 but wondered how I might be able to get the filter to sort on load perhaps?

enter image description here


Solution

  • You can use the sort_as_custom_func, just set the sort_as: 'custom' and provide sort_as_custom_func with your own sorting function, in case of issues you can debug the code a bit to see if your sort function is written properly