PDA

View Full Version : List no longer working after being popped back to via Navigation View



Soabirw
21 Apr 2012, 11:55 AM
Trying to get the NavigationView push/pop workflow smoothed out and I've run into some obstacles. Most I've managed to get through, but I'm not sure on this last one.

My first pop to the stack is a list of of items. If you select an item from the list it pushes the next view, passing in the data. You can also hit an "add" button to do the same, but with an empty data set. That part is working fine. When you click "back", using the built-in Navigation View back button, it takes you back to the first view with the item list just fine. Clicking 'Add' will push the next view again, however, clicking on a list item will not.

Instead I get an error:



Uncaught TypeError: Cannot read property 'args' of undefined
Ext.define.doFire sencha-touch-all-debug.js:17410
Ext.define.fire sencha-touch-all-debug.js:17345
Ext.define.doDispatchEvent sencha-touch-all-debug.js:22483
Ext.define.dispatchEvent sencha-touch-all-debug.js:22464
Ext.define.doFireEvent sencha-touch-all-debug.js:26712
Ext.define.fireAction sencha-touch-all-debug.js:26701
Ext.define.onItemSelect sencha-touch-all-debug.js:69091
Ext.define.doSingleSelect sencha-touch-all-debug.js:18873
Ext.define.select sencha-touch-all-debug.js:18843
Ext.define.selectWithEvent sencha-touch-all-debug.js:18762
Ext.define.onItemTrigger sencha-touch-all-debug.js:68977
Base.implement.callParent sencha-touch-all-debug.js:4546
Ext.define.onItemTrigger sencha-touch-all-debug.js:69593
Ext.define.doFire sencha-touch-all-debug.js:17418
Ext.define.fire sencha-touch-all-debug.js:17345
Ext.define.doDispatchEvent sencha-touch-all-debug.js:22483
Ext.define.dispatchEvent sencha-touch-all-debug.js:22464
Ext.define.doFireEvent sencha-touch-all-debug.js:26712
Ext.define.fireEvent sencha-touch-all-debug.js:26671
Ext.define.onItemTap sencha-touch-all-debug.js:69050
Ext.define.doFire sencha-touch-all-debug.js:17418
Ext.define.fire sencha-touch-all-debug.js:17345
Ext.define.doDispatchEvent sencha-touch-all-debug.js:22483
Ext.define.dispatchEvent sencha-touch-all-debug.js:22464
Ext.define.doFireEvent sencha-touch-all-debug.js:26712
Ext.define.fireEvent sencha-touch-all-debug.js:26671
Ext.define.onItemTap sencha-touch-all-debug.js:58551
Ext.define.doFire sencha-touch-all-debug.js:17418
Ext.define.fire sencha-touch-all-debug.js:17345
Ext.define.doDispatchEvent sencha-touch-all-debug.js:22483
Ext.define.dispatch sencha-touch-all-debug.js:17783
Base.implement.callParent sencha-touch-all-debug.js:4546
Ext.define.dispatch sencha-touch-all-debug.js:23208
Ext.define.doPublish sencha-touch-all-debug.js:23301
Ext.define.publish sencha-touch-all-debug.js:23215
Base.implement.callParent sencha-touch-all-debug.js:4546
Ext.define.publish sencha-touch-all-debug.js:23609
Ext.define.onRecognized sencha-touch-all-debug.js:23593
Ext.define.fire sencha-touch-all-debug.js:17844
Ext.define.onTouchEnd sencha-touch-all-debug.js:24552
Ext.define.invokeRecognizers sencha-touch-all-debug.js:23659
Ext.define.onTouchEnd sencha-touch-all-debug.js:23808
override.processEvent sencha-touch-all-debug.js:23880
Ext.define.onEvent sencha-touch-all-debug.js:23486
Base.implement.callParent sencha-touch-all-debug.js:4546
override.onEvent sencha-touch-all-debug.js:23876
method


I've tried resetting the list (deselecting, refreshing, etc) on the 'show' handler, but there was no change.

Here is a link to my Github project with the code: https://github.com/Soabirw/Debt-Count-Down/tree/master/DebtCountDown-SenchaTouch
(https://github.com/Soabirw/Debt-Count-Down/tree/master/DebtCountDown-SenchaTouch)
Any tips? Or am I misunderstanding push/pop all together, causing me more headaches than is necessary?

mitchellsimoens
23 Apr 2012, 7:08 AM
Why do you have setListeners? Why not just use the control config instead of this.control? Why are you executing setListeners multiple times? I recommend against the usage of the id config.

Soabirw
23 Apr 2012, 9:53 AM
The reason for setListeners() instead of just config was to resolve a separate issue that was posted in these very forums (I'll see if I can find it again). Basically when you pop back to the previous view the controller listeners set via config no longer trigger. They have to be re-assigned manually.

EDIT: I can't find the exact thread where this solution was proposed, but I did find several others having the same issue of listeners not working after popping back to the view. In one of them, you recommended playing with autoDestroy: false. I'll play around with that and see if it resolves both the issues.

Soabirw
23 Apr 2012, 10:40 AM
While playing with autoDestroy (which wasn't the issue), I changed the controller to go back to storing the control mappings in the config. This seems to work fine for the list, but not the navigation bar buttons. The Add button works once, but after popping back, it doesn't work again. This is where I had put in the excessive setListeners re-mapping. But that is not a good solution, clearly. I need to come up with a way for the doSetActiveItem override to re-initiate controller event listeners after it swaps out the rightbox buttons.

mitchellsimoens
23 Apr 2012, 11:03 AM
Or just not use the id config

Soabirw
23 Apr 2012, 11:07 AM
Or just not use the id config

You meaning referencing it via "#plan-add-btn"? What would your recommendation be?

mitchellsimoens
23 Apr 2012, 11:10 AM
You can use xtype and properties to target a component, using id is very limiting

Soabirw
23 Apr 2012, 11:32 AM
That seems to be working much more consistently. Old jQuery/prototype habits die hard. Thanks for the tips.