ext_GridPanel1_3

Ext.onReady(function(){
	//列模型
	var cm = new Ext.grid.ColumnModel([
	   new Ext.grid.RowNumberer(),
	  {header: "姓名", width: 80, dataIndex: "Name", tooltip: "这是您的姓名"},
	  {
		  header: "性别", 
		  width: 40, 
		  dataIndex: "Sex", 
		  align: "center",
		  renderer: function(v){
			  if(v == "男"){
				  return "<img src='../img/drop-yes.gif'>"
			  } 
			  return "<img src='../img/drop-no.gif'>"
		  }
	  },
	  {
		  header: "生日", 
		  width: 150, 
		  format: "Y-m-d", 
		  dataIndex: "Birthday",
		  renderer: Ext.util.Format.dateRenderer("Y-m-d")
	  },
	  {header: "学历", width: 80, dataIndex: "Education", align: "center"},
	  {id: "memo", header: "备注", dataIndex: "Memo"},
	  {
		  header: "操作",
		  width: 150,
		  dataIndex: "",
		  menuDisabled: true,
		  renderer: function(v){
			  return "<span style='margin-right: 10px'><a href='#'>修改</a></span><span><a href='#'>删除</a></span>";
		  }
		  
	  }
	]);
	
	//准备数据
	var data  = [
	    {
		   name: "李赞红",
		   sex: "男",
		   birthday: Date.parseDate("1979-04-11", "Y-m-d"),
		   edu: "本科",
		   memo: "无备注"
	   },
	    {
		   name: "陈南",
		   sex: "男",
		   birthday: Date.parseDate("1987-08-06", "Y-m-d"),
		   edu: "本科",
		   memo: "一个小帅哥哈"
	   },
	    {
		   name: "易珊静",
		   sex: "女",
		   birthday: Date.parseDate("1980-05-12", "Y-m-d"),
		   edu: "本科",
		   memo: "无备注"
	   },
	    {
		   name: "张海军",
		   sex: "男",
		   birthday: Date.parseDate("1980-12-11", "Y-m-d"),
		   edu: "本科",
		   memo: "无备注"
	   },
	];
	
	//Proxy
	var proxy = new Ext.data.MemoryProxy(data);
 

你可能感兴趣的:(gridPanel)