我用json中数据自动填充到FormPanel表单中,
但是在DateField里没有显示数据。
DateField怎么获得json里的时间?
[b]问题补充:[/b]
其他Field都可以得到数据,只是DataField里没有
以下是我得到的json,应该如何格式化?
{success:true,data:{"cbcontent":"内容5",
"cbendtime":{"date":24,"day":6,"hours":0,"minutes":0,"month":0,"seconds":0,"time":1232726400000,"timezoneOffset":-480,"year":109},
"cbid":10,"cbistop":0,"cbmsgtypeid":14,"cbposter":"","cbposterid":1,"cbposttime":{"date":13,"day":2,"hours":10,"minutes":10,"month":0,"seconds":9,"time":1231812609000,"timezoneOffset":-480,"year":109},"cbsource":1,
"cbstarttime":{"date":4,"day":0,"hours":0,"minutes":0,"month":0,"seconds":0,"time":1230998400000,"timezoneOffset":-480,"year":109},"cbtitle":"标题5","cbtoplevel":3}}
[b]问题补充:[/b]
我刚接触这个,还是不明白,代码如下,id是GRID中一行数据的ID,
功能是通过点击修改按钮,弹出修改页,修改页的Field中要填充修改前的数据。
[code="java"]function updateBulletin(id) {
var sysMsgForm = new Ext.FormPanel({
labelAlign : 'top',
frame : true,
bodyStyle : 'padding:5px 5px 0',
width : 600,
items : [{ //第一行
xtype : 'textfield',
fieldLabel : '标题',
name : 'cbtitle',
maxLength : 25,
allowBlank : false,
blankText : '标题不能为空',
anchor : '100%'
}, { //第二行
layout : 'column',
items : [{
columnWidth : .5,
layout : 'form',
items : [new Ext.form.DateField({
fieldLabel : '生效日期',
name : 'cbstarttime',
format : 'Y-m-d',
allowBlank : false,
anchor : '95%'
})
]
}, {
columnWidth : .5,
layout : 'form',
items : [new Ext.form.DateField({ // DateField
fieldLabel : '失效日期',
name : 'cbendtime',
format : 'Y-m-d',
allowBlank : false,
anchor : '95%'
})]
}]
}, { //第三行
xtype : 'textarea',
fieldLabel : '内容',
name : 'cbcontent',
maxLength : 500,
allowBlank : false,
blankText : '内容不能为空',
width : 150,
anchor : '100%'
}],
buttons : [{
text : '修改',
handler : function() {
if (sysMsgForm.form.isValid()) {
Ext.MessageBox.show({
msg : '保存中...',
progressText : 'Saving...',
width : 300,
wait : true,
waitConfig : {
interval : 200
},
icon : 'download',
animEl : 'saving'
});
sysMsgForm.form.doAction('submit', {
url : 'publishedBulletin.do',
method : 'post',
success : function(form, action) {
postWindow.close();
if (action.result.msg == 'ok') {
Ext.MessageBox.hide();
Ext.Msg.alert('提示', '修改成功!');
ds.reload();
} else {
Ext.Msg.alert('失败', action.result.msg);
}
},
failure : function() {
postWindow.close();
Ext.Msg.alert('错误', '网络连接有误');
}
});
}
}
}, {
text : '关闭',
handler : function() {
postWindow.close();
}
}]
});
var postWindow = new Ext.Window({
title : '发布公告',
width : 626,
height : 400,
collapsible : true,
maximizable : true,
plain : true,
bodyStyle : 'padding:5px;',
modal : true,
items : sysMsgForm
});
postWindow.show();
sysMsgForm.form.load({
url : 'updateBulletin.do?cbid=' + id,
waitMsg : '正在载入数据...'
});
} [/code]