【问题标题】:ExtJS 6.2 treeviewdragdrop Cannot read property 'attributes' of nullExtJS 6.2 treeviewdragdrop 无法读取 null 的属性“属性”
【发布时间】:2017-11-30 04:16:45
【问题描述】:

当我尝试在树视图中拖放一行时出现此错误:

Uncaught TypeError: Cannot read property 'attributes' of null
at constructor.updateColumns (ext-all-debug.js:205002)
at constructor.handleUpdate (ext-all-debug.js:204830)
at constructor.onUpdate (ext-all-debug.js:181917)
at constructor.fire (ext-all-debug.js:20731)
at constructor.doFireEvent (ext-all-debug.js:21700)
at constructor.prototype.doFireEvent (ext-all-debug.js:58105)
at constructor.fireEventArgs (ext-all-debug.js:21553)
at constructor.fireEvent (ext-all-debug.js:21512)
at constructor.onCollectionItemChange (ext-all-debug.js:91973)
at constructor.notify (ext-all-debug.js:74624)

这是我的插件配置:

plugins: [{
    ptype: 'treeviewdragdrop',
    appendOnly: true,
    sortOnDrop: true,
}]

我使用 Ext JS 6.2.0.981。有什么可能是错的?这不是 ExtJS 中的错误吗? 我不知道该怎么做。我在插件配置中尝试了不同的选项。

【问题讨论】:

    标签: extjs extjs6


    【解决方案1】:

    我遇到了同样的问题,我找到了解决方案。 就我而言,问题出在 treeView 中名称列的渲染器中。有问题的渲染器:

    renderer: function(value, metaData, record, rowIndex, colIndex, store, view) {
                if(value !== '')
                {
                    if(record.raw.mapped === true)
                    {
                        metaData.tdStyle = 'background-color:#c3e79d';
                    }
                }
                return value;
            }
    

    当我改为:

    renderer: function(value, metaData, record, rowIndex, colIndex, store, view) {
                if(value !== '')
                {
                    if(record.data.mapped === true)
                    {
                        metaData.tdStyle = 'background-color:#c3e79d';
                    }
                }
                return value;
            }
    

    一切正常。问题是因为丢弃的对象没有 record.raw 而是 record.data 属性!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-29
      • 1970-01-01
      • 1970-01-01
      • 2016-11-24
      相关资源
      最近更新 更多