1
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?

Benoit Cuvelier
  • 806
  • 7
  • 23
salsa111
  • 171
  • 1
  • 15

2 Answers2

1

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.

Gilsha
  • 14,431
  • 3
  • 32
  • 47
  • the component was not rendered . But when does rendering happen for a component in extjs . I am new to javascript , so I don't understand it. – salsa111 Oct 17 '15 at 09:53
  • You have put the graphPanel container as an item of the `GraphReportPanel`. I don't know to which component you are appending the GraphReportPanel, to some other component or the document body. `renderTo: Ext.get('my-div-name')` or `renderTo: Ext.getBody()` will do the job. – Gilsha Oct 17 '15 at 10:06
0

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?

Community
  • 1
  • 1
Benoit Cuvelier
  • 806
  • 7
  • 23
  • thank you .. but I think the actual cause was that the component was not rendered. So `Ext.getCmp('graphPanelId').getEl()` didn't help. – salsa111 Oct 17 '15 at 09:56