ExtJS组件 - EditorGridPanel ①

Ext.onReady(function(){
//	Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
	Ext.BLANK_IMAGE_URL = '../ext-2.2/resources/images/default/s.gif';
//	Json
	var myData = 
		[
			{name:'程仁银',sex:'男',age:'25'},
			{name:'王  佩',sex:'女',age:'44'},
			{name:'姜  新',sex:'男',age:'32'}
		];
//	JsonStore
	var store = new Ext.data.JsonStore({
		data:myData,	//	store.loadData(myData);
		fields:['name','sex','age']
	});
//	load data
//	store.loadData(myData);
//	columns
	var colM = new Ext.grid.ColumnModel(
		[
        	{header: "姓名",sortable: true, dataIndex: 'name',editor:new Ext.form.TextField()},
            {header: "性别",sortable: true,dataIndex: 'sex',editor:new Ext.form.TextField()}, //	renderer: fn
            {header: "年龄",sortable: true,dataIndex: 'age',editor:new Ext.form.TextField()}
		]
	);	
//	create new grid
	var grid = new Ext.grid.EditorGridPanel({
		store:store,
		cm:colM,
        stripeRows: true, // 隔行换色
        height:350,
        width:600,
        title:'EditorGridPanel'
	});
	grid.render('grid-example');
});

你可能感兴趣的:(json,ext)