Threaded View

  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    17
    Vote Rating
    0
    Answers
    1
    Sondergard is on a distinguished road

      0  

    Default Answered: I can only fire tap-event with fireAction('tap'), not mouseclick

    Answered: I can only fire tap-event with fireAction('tap'), not mouseclick


    I have a panel with some items, a tab bar, a carousel and a panel.

    In my controller i add a tap-event listener. When clicking the panel nothing happens, but if i use the fireAction('tap') on the panel, the event is fired as expected.


    PanelView:
    Code:
    Ext.define('Sencha.view.Main', {
    extend: 'Ext.Panel',
    config:{
    items[
    { ...
    },
    { ...
    },
    {
    xtype: 'panel',
    id: 'infoBar',
    data: {month: "June 2011"},
    tpl: [
    "<div>",
    "<div><span>{month}</span></div>", "</div>"
    ].join(""), docked: 'bottom'
    }
    ]
    }
    });
    controller:
    Code:
    init: function() {
    this.control({
    '#infoBar': { tap: function(){alert("tap")} } }); }

  2. Okay i've solved it myself.

    Using this.control() is not possible in this situation, since it makes use of ComponentQuery.

    The trick is the use Ext.get()

    Code:
    var someDiv = Ext.get("someDivId");
    
    
    someDiv.addListener('tap', function(){ alert("tap") });

Thread Participants: 1