PDA

View Full Version : Change Date-Format in Grid.RowExpander



flashg0101
3 Feb 2010, 7:16 AM
Hi,
I want to change the output of my dateFormat from (Y-m-d) to (d.m.Y) in my Grid.RowExpander. I don't know how to convert...

This is my code:
(date_String is of type "varchar" and I get it like this: YYYY-mm-dd....)



reader: new Ext.data.JsonReader({
root: 'results',
totalProperty: 'total',
id: 'space_id'
}, [ {name: 'date_string', mapping: 'date_string'}

]), baseParams: {
start:0,
limit:14
}
});


// row expander
var expander = new Ext.ux.grid.RowExpander({
tpl : new Ext.Template(
'<div class="extjs_container"><fieldset class="form_left">
'<b>Date:</b> {date_string}</fieldset>',
'</div>'

)
});





Thanks for your help

Gordon

manube
1 Apr 2010, 2:42 AM
Hello,

I think my answer come too late, but I had the same pb than you and I solved it, so it will perhaps help someone else.

First you need to specify the format of your date in the store


reader: new Ext.data.JsonReader({
root: 'results',
totalProperty: 'total',
id: 'space_id'
}, [ {name: 'date_string', mapping: 'date_string', type: 'date', dateFormat: 'd/m/Y'}
]) ...

And then apply the date format function on your data


// row expander
var expander = new Ext.ux.grid.RowExpander({
tpl : new Ext.Template(
'<div class="extjs_container"><fieldset class="form_left">
'<b>Date:</b> {date_string:date("d.m.Y")}</fieldset>',
'</div>
)
});


Manu

km00907
16 May 2011, 1:06 AM
thanks !
manube (http://www.sencha.com/forum/member.php?21428-manube)