PDA

View Full Version : Uncaught TypeError: Object [object DOMWindow] has no method 'getDate'



bee
27 Oct 2011, 7:47 AM
Hi I am trying to format date as below
datetime = Ext.Date.format(grid.data.date_time,'d/m/y H:i');
when I save the record it saves properly in the above format, but I am getting the error at console.
Uncaught TypeError: Object [object DOMWindow] has no method 'getDate'

When I expand this error message, in the js file, it was pointing to above line of code, please let me know, am I doing the right way of conversion. I am using extjs 4.0.7

skirtle
27 Oct 2011, 8:02 AM
Please always post the full stacktrace (with line numbers) when requesting help with an error.

It seems that grid.data.date_time is undefined. console.log() it on the line before to confirm.

bee
27 Oct 2011, 8:22 AM
Yes it could be coz initially when I load my gridpanel date field is empty initially
when i enter date and format then it suppose to save in database.
when I changed my code from Ext.Date.format to Ext.util.Format.date it is working fine,
Can you please suggest me how to set default value to date field before I load gridpanel.
The scenario is when I load panel, my gridpanel has two columns as empty with the help of cell editing i enter the date, the initially datefield displays as nothing . please suggest to set default value for datefield in gridpanel.
my datefield defined in gridpanel as below :

bee
27 Oct 2011, 8:25 AM
Yes it could be coz initially when I load my gridpanel date field is empty initially
when i enter date and format then it suppose to save in database.
when I changed my code from Ext.Date.format to Ext.util.Format.date it is working fine,
Can you please suggest me how to set default value to date field before I load gridpanel.
The scenario is when I load panel, my gridpanel has two columns as empty with the help of cell editing i enter the date, the initially datefield displays as nothing . please suggest to set default value for datefield in gridpanel.
my datefield defined in gridpanel as below :



{
header : 'Date/Time',
name : 'date_time',
dataIndex : 'date_time',
id : 'date_time',
renderer : Ext.util.Format.dateRenderer('d/m/Y H:i'),
width : 175,
editor : {
xtype : 'xdatetime',
value : Ext.Date.format(new Date(),'d/m/Y H:i'),
dateFormat : 'd/m/Y',
timeFormat : 'H:i'
},
allowBlank : true
}

bee
29 Oct 2011, 3:50 AM
can anyone reply here ?

bee
29 Oct 2011, 4:20 AM
yes it is. If I add single row only for other rows i get this message. but I am not sure how to fix it.