转载
http://fireinjava.iteye.com/blog/483922
var recordIds=new Array();// 选中的Record主键列id列表 var recordsChecked=new Array();// 选中的Record列表 var store = new Ext.data.JsonStore({ url : 'viewXXX.do', pruneModifiedRecords : true, totalProperty : 'totalProperty', root : 'root', fields : [{name : 'id'}, {name : 'status'} ], listeners : { load : function() { var records = new Array(); store.each(function(record) { if (recordIds.contains(record.data.id)) records.push(record); }); selMod.selectRecords(records, true);// 以后每次load数据时,都会默认选中 } } }); var selMod = new Ext.grid.CheckboxSelectionModel({ handleMouseDown : Ext.emptyFn, listeners : { "rowdeselect" : { fn : function(e, rowIndex, record) { if (recordIds.contains(record.data.id)) { recordIds.remove(record.data.id); recordsChecked.remove(record); } } }, "rowselect" : { fn : function(e, rowIndex, record) { if (!recordIds.contains(record.data.id)) recordIds.push(record.data.id); recordsChecked.push(record); } } } });