-
6 May 2012 10:44 AM #1
Unanswered: Problem with handling events in controller.
Unanswered: Problem with handling events in controller.
I have a problem with events. I have Ext.List. And I want listen a itemTap event in the Controller.
config:{ refs:{ accountList:'#accountList',} control:{ accountList:{ itemtap:'onListTap'}}}, onListTap:function(view, index, target, record, e, eOpts){//something code},But it works only first(!) time. So i have a MainView and ListView. If i go to the ListView and tap on item it works great and open a new view. If you go back to ListView and tap again it works great. But if you go to the MainView and again to the ListView event handler doesn't works. Why?
-
6 May 2012 12:04 PM #2
I have a problem with events. I have Ext.List. And I want listen a itemTap event in the Controller.
But it works only first(!) time. So i have a MainView and ListView. If i go to the ListView and tap on item it works great and open a new view. If you go back to ListView and tap again it works great. But if you go to the MainView and again to the ListView event handler doesn't works. Why?Code:config:{ refs:{ accountList:'#accountList',} control:{ accountList:{ itemtap:'onListTap' } } }, onListTap:function(view, index, target, record, e, eOpts) {//something code},
-
8 May 2012 10:23 AM #3
Is the view that you are opening with your ListView tap set to autoDestroy? If so try setting that to false and see what results you get.
-
8 May 2012 2:17 PM #4Sencha - Community Support Team
- Join Date
- Jan 2009
- Location
- Palo Alto, California
- Posts
- 1,941
- Vote Rating
- 6
- Answers
- 29
As tmcdonald indicates, it sounds like your view is being destroyed at some point and then recreated. This is currently not supported but should be fixed in either 2.0.2 or 2.1.0.
In general, it is far better to keep views that you've created as destroying and then recreating them can be an expensive process.Ext JS Senior Software Architect
Personal Blog: http://edspencer.net
Twitter: http://twitter.com/edspencer
Github: http://github.com/edspencer
-
9 May 2012 8:03 AM #5
nothing changes =( Ed, maybe you can give me advice?
-
9 May 2012 8:08 AM #6
Could you supply some of your code for the listview and the container you are displaying?
-
13 May 2012 4:38 AM #7
Code:var accountsList = { xtype: 'list', id: 'accountList', store: accountsStore, itemTpl: [ '<div class="v-my-account-title">{title}</div><div class="v-my-account-amount">{balance} р.</div>' ], listeners: { itemtap: function(view, index, target, record, e, eOpts) { Ext.getCmp('navView').push({ xtype: 'accountItem', title: record.get('title'), record: record }); } } }
This code works fine! But if I try handle itemtap event in the controller, this method works also fine until I go to the main page and go back to listview. I hope I clearly explain problem.
-
14 May 2012 6:32 AM #8
What is the property of your navigation view's autoDestroy? You should set it to false:
Code:Ext.define('MyApp.view.MyNavigationView', { extend: 'Ext.navigation.View', alias: 'widget.mainview', config: { id: 'mainview', autoDestroy: false, items: [ { xtype: 'container', items: [ { xtype: 'button', docked: 'bottom', id: 'buttonOne', text: 'ListOne' } ] } ] } });


Reply With Quote