开发者

Format date on Grid Panel not works, strange ..!

I have a gridPanel with CellEditing plugins .. !

I use datefield with renderer : Ext.util.Format.dateRenderer('Y/m/d') 开发者_JS百科The good format is dysplay , but when i get model from my grid , i have another format ...

My datefield definition :

header : 'Start Date',
                dataIndex : 'start_date',
                id : 'Start_Dategridid',

                 flex : 2,
            //renderer: formatDate,
            renderer: Ext.util.Format.dateRenderer('Y/m/d'),



                field : {

                    xtype : 'datefield',
    anchor : '20%',

     itemId: 'Start_Date',
    disabledDays : [0,6],
    altFormats: 'Y/m/d',
    format : 'Y/m/d',
    editable: false,
    value : '""',


                     allowBlank : true 
                }

When i retrieve model with :

var model =  mystore.getAt(0);
model.get('start_date'); // I have "Wed Jul 20 2011 00:00:00 GMT+0200 (CET)"

So, my application can't works .. :(


When you use get method to retrieve a value - you'll receive a fully parsed date value, this is not what is showed in the grid. After you received a value from the model - you can format it as you like.

E.g.:

console.log(Ext.Date.format(model.get('start_date'), Ext.Date.patterns.ShortDate));

You can check this link: Extjs Date

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜