javascript Uncaught TypeError: Cannot read property 'dom' of null

hi experts

when i use a code something like this in my javascript

var customerImg = Ext.create('Ext.Img', {
    src: 'images/customer.png',  
    width: 14,
    height: 14,    
    margin : '0 0 0 5',
    //renderTo: Ext.getBody(),
    listeners: {
        afterrender: function(c) {
            Ext.create('Ext.tip.ToolTip', {
                target: c.getEl(),
                html: 'This   represents customer delays.'

xtype: customerImg 

Open in new window

I end up getting error >> Uncaught TypeError: Cannot read property 'dom' of null

any idea whats wrong with the above code ?
When i comment out the above code the error goes away.

( I am using  Ext-js 4.2 )

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Pravin AsarPrincipal Systems EngineerCommented:
View the working example @

or look at the code below

Ext.define('MyImage.view.MyImg', {
    extend: 'Ext.Img',

    height: 201,
    renderTo: 'Ext.getBody(),',
    width: 400,
    src: '',
    title: 'Image Tooltip',

    initComponent: function() {
        var me = this;



// @require @packageOverrides
    enabled: true

    views: [
    name: 'MyImage',

    launch: function() {
        Ext.create('MyImage.view.MyImg', {renderTo: Ext.getBody()});


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
royjaydAuthor Commented:
Thanks . My code works fine the first time. When I close the window and open the window second time that is when I get the cannot read property Dom of null error.

Anu idea why my code gives this error only on second time?
royjaydAuthor Commented:
modified my code as per yours, seems fine now
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Pravin AsarPrincipal Systems EngineerCommented:
Thanks for the points.
royjaydAuthor Commented:
hi pravinasar

Will appreciate any help with my next question

Pravin AsarPrincipal Systems EngineerCommented:
By the time, I looked at, it is deleted.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.