1. #1
    Sencha User chris_nl's Avatar
    Join Date
    Nov 2011
    Location
    Amstedam
    Posts
    34
    Vote Rating
    0
    chris_nl is on a distinguished road

      0  

    Question How to get the click or tap event working on a Ext.Panel ?

    How to get the click or tap event working on a Ext.Panel ?


    Hello, I tried this and other solutions, but I don't see the alert box showing up.
    Am I doing it wrong? I used the sencha-touch-all.js

    Regards, Chris.

    Ext.application({
    name: 'Sencha',


    launch: function() {


    //this is the Panel we'll be adding below
    var aboutPanel = Ext.create('Ext.Panel', {
    html: 'About this app'


    });




    var otherPanel = Ext.create('Ext.Panel', {
    html: 'Another Panel'
    });


    //this is the Panel we'll be adding to
    var mainPanel = Ext.create('Ext.Panel', {
    fullscreen: true,


    layout: 'hbox',
    defaults: {
    flex: 1
    },


    items: {
    html: 'First Panel',
    style: 'background-color: #5E99CC;'
    }


    });


    Ext.Viewport.add(mainPanel);
    mainPanel.add(aboutPanel);
    mainPanel.add(otherPanel);




    aboutPanel.addListener('click', function(){alert('click'), this });
    }
    });

  2. #2
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,680
    Vote Rating
    112
    tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all

      0  

    Default


    welcome to the community chrismobile.

    first, please choose one of the correct forums to write questions to.
    i can assume that you are using Sencha Touch 1 or 2, but this already makes a big difference. If you are using the 1 / 2 Q&A forums, you will get more views and probably faster and better help.

    to your problem: you can only listen to the events of any ext component / container, that are specified in the API docs. "click" is an event for a dom node, that can not be directly put on a JS construct.

    Code:
    aboutPanel.getEl().addListener('click',...
    should already help. and please use code tags, since they preserve the formatting of code.
    Best regards
    Tobias Uhlig
    __________

    S-CIRCLES Social Network Engine

  3. #3
    Sencha User chris_nl's Avatar
    Join Date
    Nov 2011
    Location
    Amstedam
    Posts
    34
    Vote Rating
    0
    chris_nl is on a distinguished road

      0  

    Red face thanks!

    thanks!


    Thank you for your time and reply, This was my first post as I am complete new to the sencha framework. It's a really great framework!

    I will post my questions from now on in the right forum topic!

    Regards,

    Chris.

Thread Participants: 1