Results 1 to 7 of 7

Thread: Method getEl() on component/container is not defined

  1. #1
    Sencha Premium User EricRicher's Avatar
    Join Date
    Jul 2014
    Posts
    45

    Default Method getEl() on component/container is not defined

    I am trying to reproduce the code snippet that is found in the "Listening to DOM Events" in the Events section of the Core Concepts of the EXTJS Guides.

    Here's the code in the Guide:

    Code:
    var container = Ext.create('Ext.Container', {
        renderTo: Ext.getBody(),
        html: 'Click Me!',
        listeners: {
            click: function(){
                Ext.Msg.alert('Success!', 'I have been clicked!')  
            }
        }
    });
    
    
    container.getEl().on('click', function(){ 
        this.fireEvent('click', container); 
    }, container);
    The "getEl()" is not a method for containers in 6.X. It was in 5.x.

    So either the method is missing or the documentation is wrong.

  2. #2
    Sencha Premium User
    Join Date
    Feb 2010
    Location
    Chicago
    Posts
    72
    Answers
    17

    Default

    Example of listening on the element:

    Code:
    Ext.create('Ext.Container', {
        renderTo  : Ext.getBody(),
        html      : 'Click Me!',
        listeners : {
            el : {
                click : function () {
                    Ext.Msg.alert('Success!', 'I have been clicked!')
                }
            }
        }
    });

  3. #3
    Sencha Premium User EricRicher's Avatar
    Join Date
    Jul 2014
    Posts
    45

    Default

    Quote Originally Posted by Johnny Major View Post
    Example of listening on the element:

    Code:
    Ext.create('Ext.Container', {
        renderTo  : Ext.getBody(),
        html      : 'Click Me!',
        listeners : {
            el : {
                click : function () {
                    Ext.Msg.alert('Success!', 'I have been clicked!')
                }
            }
        }
    });
    Thanks for the example. It will help me achieve what I want to do.

    However, my question remains. If the getEl() method no longer exist then the documentation needs to be updated, with possibly the example you provided.

  4. #4
    Sencha Premium User
    Join Date
    Feb 2010
    Location
    Chicago
    Posts
    72
    Answers
    17

    Default

    getEl does exist, example fiddle:


  5. #5
    Sencha Premium User EricRicher's Avatar
    Join Date
    Jul 2014
    Posts
    45

    Default

    Not if you are in Modern. Try this one using Modern.

    [/QUOTE]

  6. #6
    Sencha Premium User
    Join Date
    Feb 2010
    Location
    Chicago
    Posts
    72
    Answers
    17

    Default

    I must have missed you asking about modern. Indeed that wouldn't work for the modern toolkit. I would post a link to where you're finding that in the modern toolkit api documents.

  7. #7
    Sencha Premium User EricRicher's Avatar
    Join Date
    Jul 2014
    Posts
    45

    Default

    I had not stated that I was using Modern so you did not miss it...

    I'll post it to the Ext 6 bug forum.

    Thanks for your inputs.

Similar Threads

  1. Replies: 3
    Last Post: 24 Jun 2015, 8:13 PM
  2. Uncaught TypeError: Cannot call method 'getEl' of null
    By PlasmaTek in forum Sencha Architect 3.x: Bugs
    Replies: 0
    Last Post: 10 Dec 2013, 6:38 AM
  3. Container.getEl() returns undefined causing the script to halt execution
    By momesana in forum Sencha Touch 1.x: Discussion
    Replies: 4
    Last Post: 17 Oct 2010, 11:44 PM
  4. TextArea Missing getEl() Method
    By Mark Sisson in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 19 Jul 2010, 4:55 PM
  5. Is DragZone broken? getEl references the container and not the dragEl
    By CableDawg in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 20 Jun 2007, 9:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •