Ext4.1 grid 多选(可无checkbox)

在Ext4.1中的grid默认只能实现单选的。

如果你想要你的grid有多选功能,需要给grid增加selModel

如果你使用了Ext.create('Ext.selection.CheckboxModel')-->selModel:Ext.create('Ext.selection.CheckboxModel',{mode:"SIMPLE"})

部分代码:

 1 this.grid= new Ext.grid.GridPanel({
 2             title : 'users',
 3             store : this.userStore,
 4             columns : [ {
 5                 header : "用户ID",
 6                 sortable : true,
 7                 dataIndex : 'userId'
 8             }, {
 9                 header : "用户名称",
10                 sortable : true,
11                 dataIndex : 'userName'
12             } ],
13             stripeRows : true,
14             manageHeight:true,
15             height:this.height-114,
16             selModel:Ext.create('Ext.selection.CheckboxModel',{mode:"SIMPLE"}),

界面效果:

但是这种方式会出现复选框,

如果不想有复选框是需要把selModel换成Ext.create('Ext.selection.RowModel',{mode:"SIMPLE"})就ok了

如图:

 

获得选中的数据用var records = this.grid.getSelectionModel().getSelection();就可以了

转载于:https://www.cnblogs.com/wxxian001/archive/2013/02/05/2893183.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值