1-How do I set the column to be sorted when the grid is created? then upon reloading the grid, it automatically utilize that sort to appropriately display the records.(without me clicing on it) Can this be done on the grid itself so it is independent of the underlying data store?
2-how do i change Date format displaying in a grid column?
my data render a date like this /Date(1316020760837+0000)/
i tried using renderer: Ext.util.Format.dateRenderer('m/d/Y'),// format: 'm d Y'
but it gives me NaN/NaN/NaN
any help would be appreciated. thank you
solved:
i used sortOnLoad
with sorters
var myStore = new Ext.data.JsonStore({
fields: ['Item1', 'Item2', 'Item3', 'Item4']
, data: []
, sortOnLoad: true
, sorters: { property: 'Item1', direction : 'DESC' }
});
in my c# code i used item.DateEnd.ToString("MMM dd, yyyy")
.
see this or this for standard and custom format
or better in extjs4 ,you should specify the dateFormat so Ext can parse it properly and you'll ensure it gets read ok.
{name: 'Item1' , type : 'date',dateFormat :'MS'}
u can see this for available format strings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With