PDA

View Full Version : GridView date and date store Date



saipkjai
21 Jan 2009, 6:30 PM
Hi

Right now, I was trying to retrieve some date from server side and paste it onto the editor grid. But somehow, the value it display at at the editor grid is wrong compare to the value I pass back from the datebase and from checking datestore using firebug.

eg: if I pass back "31/07/2007" (as a string) back from the database, the extjs gets it, and "07/07/2009" would be displayed on the editor grid panel

Following are the store, colulmn model and grid.




// // create the Data Store
var OtSuiteMainStore = new Ext.data.Store({
url : '../getotsuitemain',
baseParams : {
'action' : 'getOtSuiteMain'
},
reader : new Ext.data.XmlReader({
record : 'Row'
}, [
"effective_dte"
])

});
OtSuiteMainStore.load();



var OtSuiteEffDateField = new Ext.form.DateField({
id:'OtSuiteEffectiveDate',
format: "d/m/Y",
renderer: Ext.util.Format.dateRenderer("d/m/Y")
});



var OtSuiteCol = new Ext.grid.ColumnModel([{

id: "OtSuiteEffDateId",
header: 'Effect Date',
dataIndex: 'effective_dte',
width: 95,
format: "d/m/Y",
renderer: Ext.util.Format.dateRenderer("d/m/Y"),
editor: OtSuiteEffDateField
}]);



I have been banning my head onto the wall for this for the last 24 hours already...can anyone point me to the right direction...what's wrong with this?

saipkjai
21 Jan 2009, 7:19 PM
problem solved...but adding type and dateFormat to the dateStore.

{name:"close_dte", type: 'date', dateFormat: 'd/m/Y'}