ExtJS 어셈블리 - EditorGridPanel ①

1435 단어 jsonext

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');
});

좋은 웹페이지 즐겨찾기