how to call a function on a controller when Tapping on TabPanel? Sencha Touch 2

给你一囗甜甜゛ 提交于 2019-12-05 23:45:26

Instead of listening to 'tap' events on the tabs, you should listen to 'activeitemchange' on the tabpanel itself. See http://docs.sencha.com/touch/2-0/#!/api/Ext.tab.Panel-event-activeitemchange

It works when listening/Query for the html-id generated by Sencha "ext-tab-2".

for Instance:

config: {
    control: {
        "ptabpanel #ext-tab-2": {
            tap: 'onButtonTap'
        }
    }
},

But now the problem is how to change the "ext-tab-2" name generated by Sencha Touch 2

@Borck: thanks!.

Adam Klein

You can assign IDs to the tab bar buttons by adding this configuration to the tab panel:

tabBar: {
  id: 'myTabBar',
  items:[
    {
      id: 'myFirstTab'
    },
    {
      id: 'mySecondTab'
    },
    ...
   ]
 }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!