【问题标题】:ExtJS Cannot read property 'stopEvent' of undefinedExtJS 无法读取未定义的属性“stopEvent”
【发布时间】:2018-04-25 14:32:14
【问题描述】:

我使用 ExtJS 3.3 并且我有一个组合框,我试图做的是阻止对组合框中某些项目的点击操作。

我使用的代码如下;

listeners: {
    beforeselect: function(combo, record, index, e) {
        if(record.json[3] === false) {
            e.stopEvent();
        }
    }
},

它确实有效,阻止用户点击一个项目,但问题是它也会导致错误,如下所示;

Cannot read property 'stopEvent' of undefined

如果有人设法在不导致错误消息的情况下完成此操作,那么如果您可以分享它,那就太棒了。

干杯,

【问题讨论】:

    标签: javascript extjs


    【解决方案1】:

    您检查过文档吗? They state the beforeselect event doesn't have four parameters.

    To prevent the selection, as per the same docs:

    返回 false 取消选择。

    总结一下:

    listeners: {
        beforeselect: function(combo, record, index) {
            if(record.json[3] === false) {
                return false;
            }
        }
    },
    

    【讨论】:

      猜你喜欢
      • 2016-07-25
      • 2013-04-24
      • 2018-02-06
      • 2017-12-13
      • 2016-05-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-06
      相关资源
      最近更新 更多