PDA

View Full Version : Navigation View pop View breaks controllers config listeners.



munnaz1
1 Feb 2012, 9:30 PM
I have a problem with my NavigationView seeming to disconnect the ViewA-ControllerA connection when ViewA is popped from Navigation.

I have a LoginView that i load in by using



this.getNavView().push({
xtype: 'LoginView',
title:'Login'
});


I have a 'LoginController' that registers the listeners like so in the config:



config: {
views: [
'LoginView'
],
refs: {
navView: 'NavigationView',
loginFrm: 'LoginView > #loginFrm'
},




control: {
"#loginFrm": {
submit: 'onLoginFrmSubmit'
},
"#submitBtn": {
tap: 'onSubmitBtnTap'
},
"#lostPasswordBtn": {
tap: 'onLostPasswordBtnTap'
}
}
}



the registering of the tap event works first time around but when you pop back a few levels and push back to the View then all tap events do not register with the controller.....
if anyone has any thoughts and/or suggestions that would be awesome...
thanks for any time
ben.

msweltzdk
2 Feb 2012, 2:26 AM
I have a problem similar to this in 2.0 PR4 I would love to hear an answer to this one as well!

munnaz1
2 Feb 2012, 11:35 AM
i am also using
2.0 PR4...

edspencer
2 Feb 2012, 3:31 PM
Can you try upgrading your app to beta 1?

munnaz1
2 Feb 2012, 3:45 PM
just updated to beta 1 and it is now fixed.
thanks so much for your time ed its much appreciated

loving the sencha dev....

ben.

edspencer
2 Feb 2012, 3:48 PM
Awesome :) Hope you build something amazing with it

gummyavenger
11 May 2012, 12:16 PM
I'm having the same problem with 2.0.1. Is there any workaround for this?

marknalepka
13 May 2012, 12:31 PM
I'm experiencing the same problem in 2.0.1. My workaround was to manually add the "tap" event listener each time the panel is pushed on to the navigation view. I'm not saying this is the ideal solution. I plan on removing this code as soon as Sencha fixes what appears to be a recurring bug.


1) add a handler for the navigation view's "push" event in the controller as follows (where "myNav" is the ID of your navigation view instance):
control: {
"#myNav": {
push: 'onMyNavPush'
}
}
2) In the event handler function, check "item.xtype" to see if the panel being pushed to the top of the view is the panel that fires the event you are interested in. If so, manually add the event listener.
onMyNavPush: function(view, item) {

if (item.xtype == "put your panel's type here") {
//below assumes that you declared a reference to "myButton"
//in the "refs" config section
this.getMyButton().addListener("tap", this.onMyButtonTap, this);
}
}

3) You may want to remove the event listener when the panel is popped. I did not do this since it appears to working fine without this step.

Virgial
7 Nov 2012, 7:38 AM
Hi there, I had the same issue. I could only tap the button on time. After pushing the view again in the navigationView, the button wouldn't work anymore. I used the id as a selector. I simply could fix the problem by using name attr. instead of id attr. like so:

in the controller:
refs :
{
myButton : {selector:'button[name=mybutton]'}
}
in my viewPanel added the button:
{ xtype: 'button', ui :'action', text: 'unlock', name : 'mybutton' }

Hope it helps