4
votes

When an item from a list gets selected i execute the following lines of code.

this.details = Ext.create('EventManager.view.EventInfoView');
this.getNavigationView().push(this.details);

so i create a new view, and push it on a navigationview. In my controller i listen for a tap on an acceptEventButton which is inside newly created view.

Ext.define('EventManager.controller.eventController', {
extend: 'Ext.app.Controller',
config: {
    refs: {
        acceptEventButton: '#acceptEventButton'
    },

    control: {
        "acceptEventButton": {
            tap: 'onAcceptButtonTap'
        }
    }
},
...

The first time this view gets placed on the navigationview, the button tap works. When i hit the back button and push another view the button does nothing.

I'd like to solve this by doing the logic as it is now. I'd rather not add the eventlisteners myself while i'm creating the view and then push it.

Any ideas where this problem resides and how to fix?

3
Same here. I've become very frustrated with this problem, add() method also gets the same. I think it's a bug.Thiem Nguyen

3 Answers

5
votes

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'
        }
    }
2
votes

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.

0
votes

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'
    }
}