【问题标题】:Extjs 6.0.2: setStyle of nullExtjs 6.0.2:设置样式为 null
【发布时间】:2017-01-17 12:08:46
【问题描述】:

我正在另一个面板 A 内创建一个浮动面板 B(渲染到 A); 当我关闭面板 A 时,面板 B 也会关闭。但是面板 B 仍然保留在zIndexManager.zIndexStack 中。因此,调用该组件以更改其 z 并因此给出 setStyle null 错误。有什么想法吗?

var A = Ext.create('Ext.form.Panel', {
            floating: true,
            alignOnScroll: false,
            resizable: false,
            layout: 'fit',
            width: 450,
            height: 400,
            renderTo: B.id,
            items: [another Panel],
            dockedItems: [{
                xtype: 'toolbar',
                style: 'background:#f6f6f6',
                dock: 'bottom',
                layout: {
                    pack: 'center',
                    type: 'hbox'
                },
                items: [{
                        xtype: 'button',
                        ui: 'header',
                        tooltip: 'Submit',
                        iconCls: 'x-fa fa-check',
                        scope: this

                    },
                    {
                        xtype: 'button',
                        ui: 'header',
                        tooltip: 'Close',
                        iconCls: 'x-fa fa-remove',
                        scope: this,
                    }
                ]
            }]
        });

        A.showBy(this.lookupReference('abcd'), 'tl-tr?');

关闭父面板并重新打开后出现以下错误

未捕获的类型错误:无法读取 null 的属性“样式” 在 constructor.setStyle (ext-all-rtl-debug.js?_dc=20170112151748:37862) 在 constructor.setZIndex (ext-all-rtl-debug.js?_dc=20170112151748:38103) 在 constructor.setZIndex (ext-all-rtl-debug.js?_dc=20170112151748:59257) 在 constructor.onCollectionSort (ext-all-rtl-debug.js?_dc=20170112151748:124552) 在 constructor.notify (ext-all-rtl-debug.js?_dc=20170112151748:72945) 在 constructor.sortItems (ext-all-rtl-debug.js?_dc=20170112151748:73214) 在 constructor.onSortChange (ext-all-rtl-debug.js?_dc=20170112151748:73123) 在 constructor.onEndUpdateSorters (ext-all-rtl-debug.js?_dc=20170112151748:73329) 在 constructor.fire (ext-all-rtl-debug.js?_dc=20170112151748:20226) 在 constructor.doFireEvent (ext-all-rtl-debug.js?_dc=20170112151748:21133)

【问题讨论】:

  • 我的问题是为什么要使用 renderTo 将组件 A 渲染到组件 B。我认为使用 B.add(A) 会更好,因为它不会破坏框架对组件的处理。
  • @AngryLeo 你有没有找到解决方案?
  • @hbulens 无法解决这个问题,所以尝试了 daniel 的建议,它奏效了。

标签: javascript extjs extjs6 extjs6-classic


【解决方案1】:

如果你在浮动组件上手动调用destroy(),当面板A关闭时,它会解决问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-05-04
    • 2011-07-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多