gpt4 book ai didi

javascript - 无法获取 Ext.Component 的 el 元素

转载 作者:行者123 更新时间:2023-11-27 23:46:07 25 4
gpt4 key购买 nike

GraphReportPanel = function (config, initData) {
GraphReportPanel.instance = this;


this.graphPanel = new Ext.Container({
id : 'graphPanelId'
});

GraphReportPanel.superclass.constructor.call(this, {
title : 'Graph',
autoScroll: true,
id : 'graphReportPanel',
items: [this.graphPanel],
collapsible : false
});

};

我创建了 GraphReportPanel 。现在当我使用以下代码时

Ext.getCmp('graphPanelId').el.dom.innerHTML = '';

我得到 Ext.getCmp('graphPanelId').el 作为 undefined 。为什么会这样?

最佳答案

getEl() 仅当您的组件被渲染时才返回 dom 元素。调用该方法前请检查组件是否已渲染。

希望有帮助。

关于javascript - 无法获取 Ext.Component 的 el 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33169306/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com