ext_GridPanel1_四

ext_GridPanel1_4
	//Record 定义记录结果
	var Human = Ext.data.Record.create([
	   {name: "Name", type: "string", mapping: "name"},
	   {name: "Sex", type: "string", mapping: "sex"},
	   {name: "Birthday", type: "string", mapping: "birthday"},
	   {name: "Education", type: "string", mapping: "edu"},
	   {name: "Memo", type: "string", mapping: "memo"}
	]);
	
	//Reader
	var reader = new Ext.data.JsonReader({}, Human);
	
	//store
	var store = new Ext.data.Store({
		proxy: proxy,
		reader: reader
	});
	store.load();
	//列模型中的dataIndex必须和Human结构中的name属性值一一对应,这样就知道每一列显示什么值。
    //现在列模型和数据都准备好了,将这些数据做为GridPanel的选项配置传递到GridPanel的构造方法中
	//并适当设置GridPanel的外观参数,效果就出来了
	var grid = new Ext.grid.GridPanel({
		title: "中国公民",
		width: 600,
		autoHeight: true,
		cm: cm,
		store: store,
		renderTo: "a",
		autoExpandColumn: "memo" //自动伸展,占满剩余区域
	});
	//很多都是Ext.Panel中非常熟悉的参数,需要指出的是autoExpandColumn选项,该选项很有用,他能自动
	//占用剩余的空间,将面板填满,autoExpandColumn的属性值是列模型中的id属性值,为了配合该功能,”备注“列和别的
	//列不一样,多了一个id属性,千万谨记
});