salsa111
salsa111

Reputation: 181

Unable to get el element for Ext.Component

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
});

};

I have created GraphReportPanel . Now when i use the following code

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

I get Ext.getCmp('graphPanelId').el as undefined . Why is it so?

Upvotes: 1

Views: 314

Answers (2)

Gilsha
Gilsha

Reputation: 14589

getEl() returns the dom element only if your component is rendered. Please check if the component is rendered before you call this method.

Hope it helps.

Upvotes: 1

Benoit Cuvelier
Benoit Cuvelier

Reputation: 776

Use Ext.getCmp('graphPanelId').getEl() instead of Ext.getCmp('graphPanelId').el.

More information in this topic : Can you please explain .el, getEl(), Ext.get() in detail?

Upvotes: 0

Related Questions