代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Grid.html
Ext.onReady(function(){ var data = [ ['wuguangbiao', 25], ['lishi', 23], ['wangwu', 24] ]; var ds1 = new Ext.data.Store({ proxy:Ext.data.MemoryProxy(data), reader:new Ext.data.ArrayReader({id:0},[ {name:'userName'}, {name:'age'} ]), }); ds1.load(); var cm1 = new Ext.grid.ColumnModel([ {header:'userName', dataIndex:'userName'}, {headre:'age', dataIndex:'age'} ]); var grid = new Ext.grid.GridPanel('grid-example',{ds:ds1, cm:cm1}); grid.render(); grid.getSelectionModel().selectFirstRow(); });