new Ext.grid.GridPanel({
title : "用户信息管理",
width : 650,
height : 300,
store : _store,
sm:new Ext.grid.CheckboxSelectionModel(),
columns : [new Ext.grid.CheckboxSelectionModel(),{
header : "ID",
dataIndex : "id",
width : 50,
sortable : true
}, {
header : "用户名",
dataIndex : "username",
width : 80,
sortable : true
}]
});
对于如果要在grid列表前显示单选框,在columns中配置new Ext.grid.CheckboxSelectionModel()即可,如果需要进行多选,需要加上配置:sm:new Ext.grid.CheckboxSelectionModel(),如果想即使使用ctrl+鼠标左键选中也只能选中一行,可以在将sm:new Ext.grid.CheckboxSelectionModel()更改为:sm:new Ext.grid.CheckboxSelectionModel({singleSelect:true})也就是加上
singleSelect:true