【叨、校长】Extjs 动态表头GridPanel

var columnArray=["2012-01","2012-02","2012-03","2012-04","2012-05","2012-06","2012-07","2012-08","2012-09","2012-10"]
	var columns=[];
	var fields=[];
	var myData=[];
	for(var i=0;i<10;i++){
		var array=[];
		for(var j=0;j<10;j++){
			var m=parseInt(Math.random()*10+1); 
			array.push(m%3);
		}
		myData.push(array);
	}
	var store;
	var FisrtHeaderGroupRow=[];//双行表头--第一行表头
	var size=columnArray.length;
	for(var i=0;i<size;i++){
		fields.push({
			name:columnArray[i]
		});
		columns.push({
			header:columnArray[i],
			dataIndex:columnArray[i]
		})
	}
	store=new Ext.data.ArrayStore({
		fields:fields,
		data:myData
	})
	var grid=new Ext.grid.GridPanel({
		stripeRows:true,
		columns:columns,
		store:store,
		sm:new Ext.grid.CellSelectionModel(),
		iconCls:'action_group_icon'
	})

 

你可能感兴趣的:(ExtJs,grid,gridPanel,动态表头)