ext_GridPanel2_3
//Proxyvar proxy = new Ext.data.MemoryProxy(data);//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"}]);//Readervar reader = new Ext.data.JsonReader({}, Human);//storevar store = new Ext.data.Store({proxy: proxy,reader: reader});store.load();var grid = new Ext.grid.GridPanel({title: "中国公民",width: 700,autoHeight: true,cm: cm,store: store,renderTo: "a",frame: true,autoExpandColumn: "memo",buttonAlign: "center",buttons: [ { text: "第一行", handler: function(){ var rsm = grid.getSelectionModel(); //得到行选择模型 rsm.selectFirstRow(); } }, { text: "上一行", handler: function(){ var rsm = grid.getSelectionModel(); if(!rsm.hasPrevious()){ Ext.Msg.alert("警告","已经达到第一行"); } else { rsm.selectPrevious(); } } }, { text: "下一行", handler: function(){ var rsm = grid.getSelectionModel(); if(!rsm.hasNext()){ Ext.Msg.alert("警告","已经达到最后一行 "); } else { rsm.selectNext(); } } }, { text: "最后一行", handler: function(){ var rsm = grid.getSelectionModel(); rsm.selectLastRow(); } }, { text: "全选", handler: function(){ var rsm = grid.getSelectionModel(); rsm.selectAll(); } }, { text: "全不选", handler: function(){ var rsm = grid.getSelectionModel(); rsm.deselectRange(0,grid.getView().getRows().length - 1); } }, { text: "反选", handler: function(){ var rsm = grid.getSelectionModel(); for(var i = grid.getView().getRows().length - 1; i >=0; i--){ if(rsm.isSelected(i)){ rsm.deselectRow(i); } else { rsm.selectRow(i,true); //必须保留原来的,否则效果无法实现 } } } } ]});});*/?