ExtJS 3.3 Format.Util.Ext.util.Format.dateRenderer返回NaN [英] ExtJS 3.3 Format.Util.Ext.util.Format.dateRenderer returning NaN
问题描述
商店
var timesheet = new Ext.data.JsonStore(
{
root: 'timesheetEntries',
url: 'php/scripts/timecardEntry.script.php',
storeId: 'timesheet',
autoLoad: true,
fields: [
{ name: 'id', type: 'integer' },
{ name: 'user_id', type: 'integer' },
{ name: 'ticket_number', type: 'integer' },
{ name: 'description', type: 'string' },
{ name: 'start_time', type: 'string' },
{ name: 'stop_time', type: 'string' },
{ name: 'client_id', type: 'integer' },
{ name: 'is_billable', type: 'integer' }
]
}
);
我的GridPanel代码的一部分:
A section of my GridPanel code:
columns: [
{
id: 'ticket_number',
header: 'Ticket #',
dataIndex: 'ticket_number'
},
{
id: 'description',
header: 'Description',
dataIndex: 'description'
},
{
id: 'start_time',
header: 'Start',
dataIndex: 'start_time',
renderer: Ext.util.Format.dateRenderer('m/d/Y H:i:s')
}
...
从服务器,我收到这个JSON字符串:
From the server, I receive this JSON string:
{
timesheetEntries:[
{
"id":"1",
"user_id":"1",
"description":null,
"start_time":"2010-11-13 11:30:00",
"stop_time":"2010-11-13 15:50:10",
"client_id":null,
"is_billable":"0"
}
我的网格面板呈现良好。但是,我的开始和停止时间栏读取NaN / NaN / NaN NaN:NaN:NaN,我不知道为什么。
My grid panel renders fine. However, my start and stop time columns read 'NaN/NaN/NaN NaN:NaN:NaN' and I don't know why.
推荐答案
如果您的数据2010-11-13 11:30:00
您的格式不应为'Ymd H:i :s'的
?
If your data has "2010-11-13 11:30:00"
shouldn't your format be 'Y-m-d H:i:s'
?
编辑:对不起,网格配置应该可以 - 我指的是 dateFormat $ c您的商店字段定义中的$ c>值应该是
'Ymd H:i:s'
,以便您的传入数据可以正确映射到列模型。您还应该包含类型:'date'
。您没有显示您的商店配置,但问题可能是这些错误之一。
Sorry, the grid config should be OK -- I was referring to the dateFormat
value in your store's field definition, which should be 'Y-m-d H:i:s'
so that your incoming data can be properly mapped to your column model. You should also include type: 'date'
. You're not showing your store config, but the problem is likely one of those things being wrong.
这篇关于ExtJS 3.3 Format.Util.Ext.util.Format.dateRenderer返回NaN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!