javascript - Sencha ExtJs View 选择模式

标签 javascript extjs

我希望我的 Extjs 数据 View 始终至少选择一条记录。根据文档,我可以使用 mode: 'SINGLE' 和 allowedDeselect: false 来实现此结果。

                    {
                        itemId: 'data-view',
                        xtype: 'dataview',
                        trackOver: true,
                        overItemCls: 'data-over',
                        selectedItemCls: 'data-selected',
                        mode: 'SINGLE',
                        allowDeselect: false,
                        selModel: {
                            mode: 'SINGLE',
                            allowDeselect: false
                        },
                        itemSelector: me.selector, 
                        tpl: me.tpl
                    },

我将 modeallowDeselect 放在两个地方,如您所见,但它不起作用。

也就是说,我仍然可以单击数据 View 中的任何空白区域,并且所选项目将被取消选择。

你能告诉我如何正确强制 allowDeselect 为 false 吗?

最佳答案

这一定是一个错误。作为解决方法,安装此监听器:

listeners:{
    beforecontainerclick:function() {
        return false;
    }
}

关于javascript - Sencha ExtJs View 选择模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24320719/

相关文章:

javascript - 在固定高度和自动宽度的 div 中以 height=100% 居中 img

javascript - 人类可读的时间解析器

google-maps - Sencha 触摸2 : map marker titles

extjs - 覆盖 Ext.util.Format.thousandSeparator 除非格式化货币

javascript - 带有 && 和 .length 的 if 语句

javascript - 如何解决 Vue.js 中多个根元素的限制?

javascript - 是什么原因导致 $().val() 有时不起作用?

java - 在 Hadoop 中使用 ExtJS 和 Java

javascript - 如何获取自定义 ExtJS 组件以根据绑定(bind)值呈现一些 html

javascript - 分机JS : Sorting menu items hangs browser