Author Topic: Date not sorting correctly  (Read 2553 times)

janvsc

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 6
    • View Profile
Date not sorting correctly
« on: August 12, 2014, 07:48:31 am »
Hi,

I am sending a date (JSON)  to pgdgrid in the following format: DD/MM/YY and the column is defined as { title: "Date", width: 70, dataType: "date", align: "right" }
The date is displayed correctly but when I click on the column header to sort, the column is sorted as MM/DD/YY

How do I correct this?

Regards

Jan

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Date not sorting correctly
« Reply #1 on: August 12, 2014, 10:37:14 pm »
Jan

It's because the grid doesn't understand the dd/mm/yy format.

For correct sorting and filtering, you need to format the date as yyyy/mm/dd or mm/dd/yy in JSON data while you can still display the date as dd/mm/yy in the view using column.render callback.

janvsc

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Date not sorting correctly
« Reply #2 on: August 13, 2014, 04:19:18 am »
Thank you for the quick response

All good now