PDA

View Full Version : EXT JS 4.1 Dates and Safari



srarnold
4 Jul 2012, 1:03 AM
I have checked this and the Dates show in IE, FireFox(Mac/PC), Chrome(Mac/PC), even in Opera they show, yet under Safari (Mac/PC) all dates are empty, the format I use for the date in the store is the 'YYYY-MM-DDTHH:MM:SS' format, I did find some information saying that safari does not support this type, if so then how do we display dates in Safari ?

scottmartin
5 Jul 2012, 10:29 AM
Is this the format you are looking for?



// sample static data for the store
var myData = [
['3m Co', 71.72, 0.02, 0.03, '2012-01-28 09:43:19'],
['Wal-Mart Stores, Inc.', 45.45, 0.73, 1.63, '2012-01-28 09:45:21']
];

Company = Ext.extend(Ext.data.Model, {
fields: [
{name: 'company'},
{name: 'price', type: 'float'},
{name: 'change', type: 'float'},
{name: 'pctChange', type: 'float'},
{name: 'lastChange', type: 'date', dateFormat: 'Y-m-d H:i:s'}
],
idProperty: 'company'
});

// create the data store
var store = Ext.create('Ext.data.ArrayStore', {
model: Company,
data: myData
});

// create the Grid
var grid = Ext.create('Ext.grid.Panel', {
store: store,
multiSelect: true,
columns: [
{
text : 'Company',
flex : 1,
sortable : false,
dataIndex: 'company'
},
{
text : 'Price',
width : 75,
sortable : true,
renderer : 'usMoney',
dataIndex: 'price'
},
{
text : 'Change',
width : 75,
sortable : true,
dataIndex: 'change'
},
{
text : '% Change',
width : 75,
sortable : true,
dataIndex: 'pctChange'
},
{
text : 'Last Updated',
width : 200,
sortable : true,
renderer : Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
dataIndex: 'lastChange'
}
],
height: 350,
width: 600,
title: 'Array Grid',
renderTo: Ext.getBody()
});

srarnold
9 Jul 2012, 1:06 AM
Thanks, that helped me find what I was looking for, the dateFormat I needed was 'c'.