Sorting of calculated date column not working
Sorting of calculated date column not working

I am adding 8 years to the date of birth and then displaying as a new column. The sorting on this new column is not working. The date is read in from json. The dates are calculated and displayed correctly however sort gives:
I have been unable to get your required example (http://live.datatables.net/idinat/738/edit?html,css,js,console,output) to work as it is html input.
I have read the examples and "{targets: [3, 4, 7, 12, 13, 14, 15], render: $.fn.dataTable.render.moment( 'DD/MM/YYYY' )}," is included.
Kind regards,
Glyn
Replies
If you add the column after Data Table initialization it is probably not working. If you do the adding of the 8 years server side and send the additional column from the server with the other columns it should work.
Maybe it helps to do this again after adding the additional column?!
https://datatables.net/reference/api/order()
Hi rf1234,
Yes that would work. I am not a programmer, so is it preferable to do this sort of work server side or does not matter?
Kind regards,
Glyn
I do it server side because I think it is easier.
In addition, as far as I know you can't add columns after Data Tables initialization using the api.
Take a look at this please. The author of Data Tables @allan gave some valuable comments on it:
https://datatables.net/forums/discussion/57727
Because I think it is much easier to return additional columns (i.e. columns that don't exist in the data base) I do this using Editor using aliases of existing columns like this for example. dob is the database column and dob_plus_eight_years is the calculated column that doesn't exist in the database.
OK, I will look at it from this angle. Thank you :-)