Solved

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

Posted on 2014-09-30
6
2,847 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 29

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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 29

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 29

Expert Comment

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

Thanks
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
This article discusses how to implement server side field validation and display customized error messages to the client.
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…
Suggested Courses

623 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