简体   繁体   中英

Sencha Touch 2.1 tap entire toolbar

I need to be able to tap/click on the entire toolbar at the bottom of my page and either go to another screen or have a popup.

Why you ask? Because I have a logo for now as my title. Plus this was the easiest way with the least code I could figure out to get a logo at the bottom, that was docked, and did not change as the pages changed. Essentially my toolbar is a link or popup to an "about" page.

Here is what I have that seems to work with buttons.

{
  xtype : 'toolbar',
  docked: 'bottom',
  title: '<img src="logo.png" id="logo" alt=""/>',
  handler: function() {
    Ext.Msg.alert('About', 'You clicked about');
  }
}

I also tried this with no luck.

{
  xtype : 'toolbar',
  docked: 'bottom',
  title: '<img src="logo.png"/>',
  listeners: {
    tap: function() {
      alert("You tapped me");
    }
  }
}

Thanks, Donnie

You can just simply do like this:

{
    xtype : 'toolbar',
    docked: 'bottom',
    title: '<img src="logo.png"/>',
    listeners: {
        initialize: function() {
            this.element.on({
                tap: function() {
                    alert("You tapped me");
                }
            })
        }
    }
}

Hope it helps :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM