extjs 日期不显示

 Ext.onReady(function(){
           //初始化全局 QuickTips 实例  使得tip提示可用
            Ext.QuickTips.init();
           //别名
           var xg=Ext.grid;
           
           //创建一个ArrayReader
          var reader=new Ext.data.ArrayReader({},[
                   {name:"name",type:"string"},
                   {name:"age",type:"int"},
                   {name:"empno",type:"int"},
                   {name:"sex",type:"int"},
                  {name:"birthday",type:"date",dateFormat:"n/j h:ia"},
                   {name:"salary",type:"float"},
                   {name:"deptno",type:"int"},
                   {name:"desc",type:"string"}
                 ]);
           
           //创建一个RowExpander,行展开的时候的样式
             var expander=new Ext.ux.grid.RowExpander({
                tpl:new Ext.Template(
                 '<p><b>姓名:</b>{name}</p><br/>',
                 '<p><b>描述信息:</b>{desc}</p>'
                )              
             }); 
             
             
             //性别的ernderer
             function sexCls(val){
              return val==0? "male" : "female";
             }
             
             
           //创建一个grid
           var grid1=new xg.GridPanel({
             store:new Ext.data.Store({
              reader:reader,
              data:xg.dummyData//数据模型
             }),
             cm:new xg.ColumnModel({
              defaults:{
                width:20,
                sortable:true
              },
              columns:[
               expander,
               {header:"姓名",dataIndex:"name"},
               {header:"年龄",dataIndex:"age"},
               {id:"empno",header:"编号",width:40,dataIndex:"empno"},
               {header:"性别",dataIndex:"sex",renderer:sexCls},
               {header:"生日",dataIndex:"birthday",renderer:Ext.util.Format.dateRenderer("Y-m-d"),dataIndex:"birtdhay"},
               {header:"工资",dataIndex:"salary",dataIndex:"salary"},
               {header:"部门编号",dataIndex:"deptno"}
              ]
             }),
             viewConfig:{//作用在grid's UI试图上的配置项对象, 任何Ext.grid.GridView可用的配置选项都可在这里指定。若view已指定则此项无效
             forceFit:true
             },
            width:600,
            height:300,
            plugins:expander,
            collapsible:true,//True表示为面板是可收缩的
            animCollapse:false,//True 表示为面板闭合过程附有动画效果
            title:"雇员的信息",
            iconCls:"icon-grid", //为该面板设置图标的样式类。此方法会覆盖当前现有的图标
            renderTo:document.body //提供到窗体的body上
           });
  });    
        
        
             //数据
                 Ext.grid.dummyData=[
                ["张三00",12,1001,1,"1990-05-20",3000,50],
                ["张三01",16,1002,0,"1990-05-21",3000,20],
                ["张三02",19,1003,1,"1990-05-22",3000,20],
                ["张三03",25,1004,1,"1990-05-23",3000,10],
                ["张三04",22,1005,1,"1990-05-24",3000,30],
                ["张三05",24,1006,1,"1990-05-25",3000,20],
                ["张三06",23,1007,0,"1990-05-26",3000,60],
                ["张三07",21,1008,0,"1990-05-27",3000,90],
                ["张三08",25,1009,0,"1990-05-28",3000,10],
                ["张三09",28,1010,1,"1990-05-29",6000,20],
                ["张三20",26,1011,0,"1990-05-20",2000,50],
                ["张三21",29,1012,0,"1990-06-20",8000,40],
                ["张三22",22,1013,1,"1990-01-20",3000,50],
                ["张三23",28,1014,0,"1990-02-20",3000,60],
                ["张三24",21,1015,1,"1990-08-20",3000,50]
               ];
               
               
       // 添加描述信息
		for(var i = 0; i < Ext.grid.dummyData.length; i++){
		    Ext.grid.dummyData[i].push('这个是一个简单的演示的信息,测试描述信息的.');
		}

上面是我的代码:

注意我的日期的格式,

还有解析的格式

需要注意的是,你的格式是什么样子的,那么需要在解析的时候就以什么格式解析改:Y-m-d

]还有一个地方:

应该改成birthday和reader中的一致

你可能感兴趣的:(ExtJs)