• Resolved JimmyEdmondson

    (@jimmyedmondson)


    Hi Tobias,

    Thanks again for your previous help. I sent a donation a couple of weeks back from minuteworks.co.uk.

    I am just trying to make my date column sort correctly but I can’t get it to work. I’ve followed your advice here (https://tablepress.org/extensions/datatables-sorting-plugins/) and here (https://www.ads-software.com/support/topic/date-field-not-sorting-correctly/).

    My custom commands currently looks like this:

    "columnDefs": [ 
    	{"visible": true, "targets": [0,2,4,5,8,10]},
    	{"visible": false, "targets": '_all'},
            { "type": "date", "targets": [ 2 ] },
    ],
    "buttons":[
    	{
    		"extend": "colvis",
    		"text": "Show/Hide Columns"
    	},
    {
    		"extend": "csv",
    		"text": "Export",
            "exportOptions": {
                "columns": ":visible"
            }
    	}
    ]

    Before I added that custom command code it was sorting but just not in the correct order. Now it appears to have completely stopped the sorting from working. Do you have any advice?

    Many Thanks,
    Jimmy

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    My recommendation would indeed be to use the TablePress Extension from https://tablepress.org/extensions/datatables-sorting-plugins/ here.
    Then, to allow sorting of your table’s dates (in the third column), you’ll have to assign the date-eu data type, i.e.

    { "type": "date-eu", "targets": [ 2 ] }
    

    in that “Custom Command”.

    Regards,
    Tobias

    Thread Starter JimmyEdmondson

    (@jimmyedmondson)

    Thanks Tobias! That worked perfectly. I think I’m finally finished with this project now.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! ?? Good to hear that this helped!

    Best wishes,
    Tobias
    ?
    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Date field sorting problem’ is closed to new replies.