I have a JSON store that is configured with a field with a type of 'date' and dateFormat set to 'Y-m-d H:i:s' (mysql date format) defined as follows:
Code:
dsLocation = Ext.extend(Ext.data.JsonStore, {
constructor: function(cfg) {
cfg = cfg || {};
dsLocation.superclass.constructor.call(this, Ext.apply({
storeId: 'dsLocation',
root: 'rows',
url: 'locations/grid_locations.php',
idProperty: 'loc_id',
messageProperty: 'user_message',
totalProperty: 'results',
autoLoad: true,
remoteSort: true,
fields: [
...
{
name: 'updt_dt',
type: 'date',
dateFormat: 'Y-m-d H:i:s'
},
...
]
}, cfg));
}
});
I also have a grid configured to use the store with a date column as defined as follows:
Code:
LocMaintWindowUi = Ext.extend(Ext.Window, {
title: 'Location Maintenance',
width: 1015,
height: 690,
layout: 'border',
initComponent: function() {
this.items = [
{
xtype: 'grid',
store: 'dsLocation',
region: 'north',
height: 206,
margins: '5px 5px 0px 5px',
split: true,
closable: true,
autoExpandColumn: 'name',
ref: 'loc_maint_grid',
id: 'loc_maint_grid',
selModel: new Ext.grid.RowSelectionModel({
singleSelect: true
}),
columns: [
...
{
xtype: 'datecolumn',
header: 'Update',
sortable: true,
width: 115,
dataIndex: 'updt_dt',
format: 'm/d/Y h:i a'
}
...
]
},
...
];
LocMaintWindowUi.superclass.initComponent.call(this);
}
});
When the grid gets the loaded from the store, the date columns look fine, but after calling the form's submit action to update an existing record or insert a new record and then calling JsonReader.update(...) or JsonReader.realize(...), the date column for that record displays a bunch of not a number values...
Code:
this.loc_maint_form.getForm().submit({
url:'locations/location.php',
params: {crud_action: crudAction},
waitMsg:'Processing Data...',
success: function (form, action) {
var grid = form.ownerCt.loc_maint_grid; // get the gridPanel
var selModel = grid.getSelectionModel(); // get the selection model
var dsLoc = grid.getStore(); // get the data store
var selRec = selModel.getSelected(); // get the selected record
if (crudAction == 'INSERT') {
dsLoc.reader.realize(selRec, action.result.rows)
} else {
dsLoc.reader.update(selRec, action.result.rows)
}
selModel.selectRow(dsLoc.indexOf(selRec));
},
...
The data returned from the form's submit action and being passed into update()/realize() is in the same format as the data returned from the initial grid load...
Guess I'm wondering why the reader is not converting the date field's data from incoming 'Y-m-d H:i:s' format to a native JavaScript Date object for update()/realize() like it does on the initial grid load().
Is there a something that I missed in my configuration (using Ext JS Designer)?
You can see the application here http://ccbdb.com/xds_index.html
Thanks and Regards,
-- Greg