ExtJS 구성 요소 - GridPanel ②

1365 단어 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'},
            {header: "  ",sortable: true,dataIndex: 'sex'}, //	renderer: fn
            {header: "  ",sortable: true,dataIndex: 'age'}
		]
	);	
//	create new grid
	var grid = new Ext.grid.GridPanel({
		store:store,
		cm:colM,
        stripeRows: true, //     
        height:350,
        width:600,
        title:'Array Grid'
	});
	grid.render('grid-example');
	grid.getSelectionModel().selectFirstRow();
});

좋은 웹페이지 즐겨찾기