1. #11
    Sencha User
    Join Date
    Aug 2012
    Posts
    18
    Vote Rating
    0
    SammyO is on a distinguished road

      0  

    Default


    Thanks!
    In Sencha Fiddle it works exactly like I want, but if I copy paste it into my app, the layout is the same, but no messages/console.logs appear.

    I adjusted the code a bit, since I already have a launch function etc, to the following:

    Code:
            var login = new Ext.Panel({
                fullscreen: true,
                id: 'background01',
                style: 'background: red;',
                items: [{
                    cls: 'wowpanel',
                    html: 'Login',
                    id:'wowpanel',
                    centered: true,
                    style:'background: white; color: black;',
                    zIndex:1,
                    listeners : {
                        initialize: function(clickableComponent){
    			console.log("hi");
                            clickableComponent.element.on('tap',function(e,el){
                                
                                console.log('button tap');
                                
                            })
                                }
                    }
                }],
                listeners : {
                    
                    initialize: function(clickableComponent){
    			console.log("hi");
                        clickableComponent.element.on('tap',function(e,el){
                            console.log('background tap');
                        })
                            }
                }
            });

  2. #12
    Sencha User
    Join Date
    Apr 2010
    Location
    China
    Posts
    227
    Answers
    64
    Vote Rating
    20
    haduki will become famous soon enough haduki will become famous soon enough

      0  

    Default


    I have read your code.You missed "e.stopPropagation();"if you want to separate the event.

    there is no messages/console.logs appear
    make sure you have imported the view or create it.
    Code:
    //new Ext.Panel({})
    Ext.create('Ext.Panel',{})
    // and do not forget requires/views config.
    I write English by translator.

  3. #13
    Sencha User
    Join Date
    Aug 2012
    Posts
    18
    Vote Rating
    0
    SammyO is on a distinguished road

      0  

    Default


    I'm not using an MVC structure...
    Also, when I copy paste your code, except for the first launch and setup functions (so see code below), I'm not getting any kind of output/message/alerts...

    Code:
    var login = new Ext.Panel({            fullscreen: true,
                id: 'background01',
                style: 'background: red;',
                items: [{
                    cls: 'wowpanel',
                    html: 'Login',
                    id:'wowpanel',
                    centered: true,
                    style:'background: white;',
                    zIndex:1,
                    listeners : {
                        initialize: function(clickableComponent){
                            clickableComponent.element.on('tap',function(e,el){
                                
                                Ext.Msg.alert('button tap');
                                e.stopPropagation();
                                
                                
                            })
                                }
                    }
                }],
                listeners : {
                    
                    initialize: function(clickableComponent){
                        clickableComponent.element.on('tap',function(e,el){
                            Ext.Msg.alert('background tap');
                        })
                            }
                }
            });

  4. #14
    Sencha User
    Join Date
    Aug 2012
    Posts
    18
    Vote Rating
    0
    SammyO is on a distinguished road

      0  

    Default


    Also, when I add a console.log to the initialize function, before the clickableComponent.element.on(), I'm not getting any output either. Seems like the initialize events aren't even fired?

Thread Participants: 2

Tags for this Thread