dev
dev

Reputation: 1387

ExtJs Date is not displayed in Grid in Interner Explorer/ Mozilla

I'm trying to display a date column in a grid using ExtJs 4.1.
My model is

   fields: [
             {name: 'MYDATE',   type: 'date'}
           ]

and the response I get from the server is

  {
   "success": true,
  "totalRows": "1",
  "data": [
           {
            "MYDATE": "2015-01-22 09:47:43"
           }
         ]
  }

In chrome it works

enter image description here

but in IE10 and Mozilla it does not.

enter image description here

Just to mention that this problem comes before applying renderers

enter image description here

enter image description here

I have also tried to add format in the model

   fields: [
             {name: 'MYDATE',   type: 'date', format : 'c'}
           ]

The database MSSQL has the value

           2015-01-22 09:47:43.590

What am I doing wrong?

Upvotes: 2

Views: 1480

Answers (2)

3rgo
3rgo

Reputation: 3153

To specify a Date format in a model, you must use the dateFormat property, not format : http://docs.sencha.com/extjs/4.2.3/#!/api/Ext.data.Field-cfg-dateFormat

Your error is caused by your server returning a date in the Y-m-d H:i:s format instead of the standard UTC format. Chrome and Safari will interpret this, but Firefox and IE will not.

Upvotes: 2

Will S
Will S

Reputation: 755

Have you tried:

format: 'Y-m-d H:i:s'

More information on formats here

Upvotes: 0

Related Questions