仅在单击复选框时才选择行ExtjS 4 [英] select row only when checkbox is clicked ExtjS 4

查看:166
本文介绍了仅在单击复选框时才选择行ExtjS 4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用CheckboxModel作为选择模型的ExtJS 4.1网格中,当您单击整行时,将选中该行(并选中相应的复选框).有没有一种方法可以防止这种默认行为发生,并且仅当单击相应行的复选框时才允许选择行(而不是单击整个行时)?

In an ExtJS 4.1 grid that uses CheckboxModel as a selection model, when you click on an entire row, that row is selected (and the corresponding checkbox is checked). Is there a way that I can prevent that default behaviour from happening and permit row selection only when the checkbox for a corresponding row is clicked (as opposed to when clicking the entire row)?

再次使用ExtJS 4.1版

Again I'm using ExtJS version 4.1

感谢您的帮助

注意:我的网格还具有

Note: My grid also has the CellEditing plugin attached to it. I don't want the row to be selected when the CellEditing plugin gets activated when I click on a cell.

推荐答案

尝试在CheckBoxModel上使用checkOnly属性:

Try the checkOnly property on your CheckBoxModel:

var sm = new Ext.selection.CheckboxModel({
    checkOnly: true
});

从文档中:

http://docs .sencha.com/extjs/4.1.3/#!/api/Ext.selection.CheckboxModel-cfg-checkOnly

checkOnly : Boolean

True if rows can only be selected by clicking on the checkbox column.

Defaults to: false

请在此处查看我的小提琴以获取工作示例: https://fiddle.sencha.com/#小提琴/vue

Please see my fiddle here for a working example: https://fiddle.sencha.com/#fiddle/vue

更新

要在渲染网格后更改CheckBoxModel checkOnly模式:

To change the CheckBoxModel checkOnly mode after the grid has been rendered:

grid.getSelectionModel().checkOnly = true;

这篇关于仅在单击复选框时才选择行ExtjS 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆