1. #1
    Sencha User
    Join Date
    Feb 2013
    Location
    Venray NL
    Posts
    19
    Vote Rating
    0
    Answers
    1
    art.com is on a distinguished road

      0  

    Default Answered: NaN-NaN-0NaN NaN:NaN

    Answered: NaN-NaN-0NaN NaN:NaN


    Hi all,

    I've got this bug that is driving me crazy. A datefield in a grid is displaying NaN-NaN-0NaN NaN:NaN as a value in Firefox and IE. But in Chrome is is showing the date and time correctly.

    It must be a small option somewhere, but at the moment I can't find it. Is someone here able to track it down?

    RETURNED FROM DATABASE:
    Code:
    {"data":[{"id":1,"type":"Day off","startDate":"2013-03-01 08:00:00.0000000","endDate":"2013-03-01 17:00:00.0000000","comment":"Testing","addDate":"2013-03-28 14:53:00.0000000","addUser":"tswinkels","chngDate":null,"chngUser":null}]}
    GRID:
    Code:
    ...
    xtype: 'gridpanel',
    margin: 20,
    bodyBorder: true,
    allowDeselect: true,
    columnLines: true,
    enableColumnHide: false,
    enableColumnMove: false,
    forceFit: true,
    store: 'employee.absence',
    columns: [
    	{
    		xtype: 'rownumberer'
    	},
    	{
    		xtype: 'datecolumn',
    		dataIndex: 'startDate',
    		menuDisabled: true,
    		text: 'Start date',
    		format: 'd-m-Y H:i'
    	},
    	{
    		xtype: 'datecolumn',
    		dataIndex: 'endDate',
    		menuDisabled: true,
    		text: 'End date',
    		format: 'd-m-Y H:i'
    	},
    	{
    		xtype: 'gridcolumn',
    		dataIndex: 'type',
    		menuDisabled: true,
    		text: 'Type of absence'
    	},
    	{
    		xtype: 'datecolumn',
    		dataIndex: 'addDate',
    		menuDisabled: true,
    		text: 'Add date',
    		format: 'd-m-Y'
    	},
    	{
    		xtype: 'gridcolumn',
    		dataIndex: 'comment',
    		menuDisabled: true,
    		text: 'Comment'
    	},
    	{
    		xtype: 'gridcolumn',
    		dataIndex: 'addUser',
    		menuDisabled: true,
    		text: 'Added by'
    	}
    ],
    dockedItems: [
    	{
    		xtype: 'pagingtoolbar',
    		dock: 'bottom',
    		displayInfo: true,
    		store: 'employee.absence'
    	}
    ]
    ...
    MODEL:
    Code:
    Ext.define('framedash.model.employee.absence', {
    	extend: 'Ext.data.Model',
    
    
    	fields: [
    		{
    			name: 'id'
    		},
    		{
    			name: 'type'
    		},
    		{
    			dateReadFormat: 'Y-m-d H:i:s.u',
    			dateWriteFormat: 'd-m-Y H:i',
    			name: 'startDate'
    		},
    		{
    			dateFormat: 'd-m-Y H:i',
    			dateReadFormat: 'Y-m-d H:i:s.u',
    			name: 'endDate'
    		},
    		{
    			name: 'comment'
    		},
    		{
    			dateFormat: 'd-m-Y H:i',
    			dateReadFormat: 'Y-m-d H:i:s.u',
    			name: 'addDate'
    		},
    		{
    			name: 'addUser'
    		},
    		{
    			name: 'chngDate'
    		},
    		{
    			name: 'chngUser'
    		}
    	]
    });

  2. Make sure your date field has a type: 'date' config on it.

    Code:
    type: 'date',
    dateReadFormat: 'Y-m-d H:i:s.u',
    dateWriteFormat: 'd-m-Y H:i',
    name: 'startDate'

  3. #2
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,062
    Vote Rating
    215
    Answers
    486
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      0  

    Default


    Make sure your date field has a type: 'date' config on it.

    Code:
    type: 'date',
    dateReadFormat: 'Y-m-d H:i:s.u',
    dateWriteFormat: 'd-m-Y H:i',
    name: 'startDate'

  4. #3
    Sencha User
    Join Date
    Feb 2013
    Location
    Venray NL
    Posts
    19
    Vote Rating
    0
    Answers
    1
    art.com is on a distinguished road

      0  

    Default


    Thanks Slemmon! It fixed this issue, completely forgot to check this setting at the model

Thread Participants: 1

Tags for this Thread