3

在下面的代码中,我无法在网格面板中获取生日字段,

var store = new Ext.data.SimpleStore({
    fields:[
       'name',
       'phone',
       'email',
       {name:'birthday', **type:'date', dateFormat:'m/d/y'**}
       ]
});

 var myData = [
               ['Meyers, Quyn R.', '(943) 570-5141', 'Proin@nullamagna.ca', '05/13/1990'],
               ['Whitney, Tad T.', '(547) 743-0343', 'vulputate@acurnaUt.org', '05/10/1987'],
              ];

store.loadData(myData);

var grid = new Ext.grid.GridPanel({
    store:store,
    columns:[{header:'NAME', width:170 , sortable:true, dataIntex:'name'},
             {header:'PHONE NO', width:150 , sortable:true, dataIntex:'phone'}, 
             {header:'EMAIL ', width:150 , sortable:true, dataIntex:'email'},
             {header:'BirthDate ', width:100 , sortable:true, dataIntex:'birthday',**renderer: Ext.util.Format.dateRenderer('d/m/Y')** }
             ],
    title:'My Contacts',
    autoHeight:true,
    width:590,
    //renderTo:document.body(),
    fram:true
}); 
4

1 回答 1

3

dateFormat您的birthday字段配置有误。应该:

{ name : 'birthday', type : 'date', dateFormat : 'm/d/Y' }

希望这有帮助。

于 2012-10-02T17:41:17.577 回答