Solved

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

Posted on 2014-09-30
6
2,614 Views
Last Modified: 2014-10-01
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 )

thanks.
0
Comment
Question by:royjayd
  • 3
  • 3
6 Comments
 
LVL 28

Accepted Solution

by:
Pravin Asar earned 500 total points
ID: 40354335
View the working example @ https://fiddle.sencha.com/fiddle/b63

or look at the code below

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

    height: 201,
    renderTo: 'Ext.getBody(),',
    width: 400,
    src: 'http://www.sencha.com/img/20110215-feat-html5.png',
    title: 'Image Tooltip',

    initComponent: function() {
        var me = this;

        me.callParent(arguments);
    }

});

// @require @packageOverrides
Ext.Loader.setConfig({
    enabled: true
});


Ext.application({
    views: [
        'MyImg'
    ],
    name: 'MyImage',

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

});
0
 

Author Comment

by:royjayd
ID: 40354422
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?
0
 

Author Closing Comment

by:royjayd
ID: 40354762
modified my code as per yours, seems fine now
thanks
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 28

Expert Comment

by:Pravin Asar
ID: 40355080
Thanks for the points.
0
 

Author Comment

by:royjayd
ID: 40355258
hi pravinasar

Will appreciate any help with my next question
http://www.experts-exchange.com/Programming/Languages/Java/Q_28529299.html

thanks.
0
 
LVL 28

Expert Comment

by:Pravin Asar
ID: 40356205
By the time, I looked at, it is deleted.

Thanks
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Make Session back to empty 9 30
How to make button inactive until I fill in all the boxes. 11 20
Possible propagation problem 1 25
Non-Resizable Pharagraph 2 8
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question