How can I sort "number | year" column?

How can I sort "number | year" column?

ehudgehudg Posts: 2Questions: 2Answers: 0

Hi

I have a column with the following format:

day_in_year | year

Example:
61 | 2018

I need a way to sort this column (like the de_date plugin), given that 99 | 2017 < 1 | 2018.

I've tested the plugins from https://datatables.net/plug-ins/sorting/, but did not found anything helpful.

Many thanks for this great tool!

Answers

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    I think you'd need your own sorting plug-in for this one. Details on how to write one are here - all you really need here is a split on the pipe and return the number you want to sort on from the -pre method.

    Allan

This discussion has been closed.