button tap not reacting when view gets added a 2nd time

做~自己de王妃 提交于 2019-12-01 18:44:58

A new version of sencha architect was released which allows adding not listed properties.

I solved this by adding an action field on my button, and in my controller reacting to that action.

{
    xtype: 'button',
    id: 'acceptEventButton',
    ui: 'confirm',
    text: 'Accept',
    action: 'acceptEvent'
}

and in my controller i have the following lines of code

    control: {
        "button[action=acceptEvent]": {
            tap: 'onAcceptButtonTap'
        }
    }

i faced same problem earlier and it was solved by setting
autoDestroy: false,
at config of my navigationView

its very well working after applying false to this autoDestroy property.
hope it will work for you too.

You should change your query as follows:

control: {
    "button[id='acceptEventButton']": {
        tap: 'onAcceptButtonTap'
    }
}

As an extra information: You can also use xtype in these queries.
For example if you have a navigationview as follows:

Ext.define('app.view.Pages', {
    extend: 'Ext.NavigationView',
    xtype: 'pages',
    ...
}

and you push a list to it like this:

Ext.define('app.view.ItemList', {
    extend: 'Ext.dataview.List',
    xtype: 'itemlist',
    ...
}

then you can write your query as follows:

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