AJAX 요청을 전송하여 데이터베이스에서 Json 데이터를 검색하고 있습니다.ExtJs 3.4 : 문자열 유형 날짜를 날짜 필드의 값으로 설정하십시오.
{'tourData':[{ 'code' : '6', 'ref' : '22/01/2014 09:08:54-Route 2', 'vehicle' : 'GY-122-120', 'fromDate' : '2014-01-22 00:00:00', 'toDate' : '2014-01-22 00:00:00', 'tourAssign' : 'Saman', 'driver' : 'Kamal Subhasingha', 'assistant' : 'Sampath Jayaweera', 'porter1' : 'Namal Witharana', 'porter2' : 'Yohan', 'porter3' : 'Ahan Liyanage' } ]}
날짜 필드의 값으로 'fromDate'를 설정하려고합니다.
new Ext.form.DateField({
id : 'fromDateCombo',
fieldLabel : 'From Date',
allowBlank : false,
width : 140,
name : 'fromDate',
emptyText : 'From Date',
hideLabel : true,
format: 'd/m/Y',
style : 'marginleft:10px',
disabled : true,
listeners : {
select : function() {
if (Ext.getCmp('toDateCombo').getValue()< this.getValue()) {
Ext.Msg.show({
title: 'Error',
msg: 'From Date should be less than or equal To Date' ,
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.ERROR
});
this.setValue(sysDate);
}
}, render: function(c) {
new Ext.ToolTip({
target: c.getEl(),
html: 'From Date'
});
}
}
});
나는 이것을 시도했다.
var jsonData = Ext.util.JSON.decode(response.responseText);
console.log(jsonData);
if (jsonData.tourData.length > 0) {
Ext.getCmp('fromDateCombo').setValue(Date.parseDate(String(jsonData.tourData[0].fromDate), 'd/m/Y'));
}
그러나 날짜를 설정하지 않고 방화 벽 콘솔에 오류 메시지를 인쇄하지 않습니다.
내 코드에 어떤 문제가 있으며 어떻게 해결할 수 있습니까?
친절 감사