grid.getSelectionModel().getSelections()
其中grid.getSelectionModel()实际上是选择了该gird的sm,例:
var sm = new xg.CheckboxSelectionModel();
var grid2 = new xg.GridPanel({
store: new Ext.data.Store({
reader: reader,
data: xg.dummyData
}),
cm: new xg.ColumnModel([
sm,
{id:'company',header: "Company", width: 200, sortable: true, dataIndex: 'company'},
{header: "Price", width: 120, sortable: true, renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
{header: "Change", width: 120, sortable: true, dataIndex: 'change'},
{header: "% Change", width: 120, sortable: true, dataIndex: 'pctChange'},
{header: "Last Updated", width: 135, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
]),
sm: sm,
width:600,
height:300,
frame:true,
title:'Framed with Checkbox Selection and Horizontal Scrolling',
iconCls:'icon-grid',
renderTo: document.body
});
其中var sel = grid2.getSelectionModel().getSelections();
var sel = sm.getSelections();均可
这个问题得分成两个问题,第一,你是否用了官方提供的选择插件,如果上,楼上的回答就可以采纳了,
第二,如果你是自定义写了这么一个checkbox,那么方法就有点蠢了,使用生成时ID引用即可
grid.getSelectionModel().getSelections();这些API文档有的,多查下文档