Author Topic: dataType:date raw date format inquery  (Read 1803 times)

YONGHOO KIM

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 20
    • View Profile
dataType:date raw date format inquery
« on: May 14, 2020, 05:51:52 am »
Hi, param query
our raw data format is not "dd/mm/yyyy" also "yyyy-mm-dd"
Server returns like '20200514'.
How can I display on grid without change raw data?

{
   dataType: "date", format: "yy-mm-dd"
}


expected : Display "2020-05-14" in grid
actual: "NaN-NaN-NaN"

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: dataType:date raw date format inquery
« Reply #1 on: May 14, 2020, 09:05:02 am »
grid expects date fields in ( mm/dd/yy or yy-mm-dd ) format for correct sorting, formatting, filtering, etc.

If it's not possible for you to make changes on server side, then you can correct the format in dataModel.getData callback.

https://paramquery.com/pro/api#option-dataModel-getData

Code: [Select]
dataModel: {
  getData: function( response ){
     //loop through respone.data and make changes in date fields.   
  }
}

Please let me know if you need further assistance on this.