-
19 Mar 2012 11:05 AM #1
Answered: firing events on controller from view
Answered: firing events on controller from view
I am not sure how I can fire an event on the controller from my view. I want the event to be triggered from the view .. something like
on the controller side I want to capture this event but I dont want to create a hard reference to this list. I simply want the event to be fired on the controller without it knowing about who fired it Because the same controller is supposed to handle these events from multiple lists.Code:listeners: {itemtap: function(dv, i, t, r, evt){ console.log('itemtap called'); //get the selected element var el = Ext.get(evt.target); //fire the selected event this.fireEvent('tapListingItem', r, el); } }
Thanks
Adeel
-
Best Answer Posted by mitchellsimoens
This is up to your ComponentQuery in the control config in the controllers. If it is generic enough then it won't be bound to knowing the application structure.
That is generic to listen to any tapListingItem event on any dataview (or subclass like List).Code:control : { 'dataview' : { tapListingItem : 'onTapListingItem' } }
-
19 Mar 2012 12:12 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
- Answers
- 3161
This is up to your ComponentQuery in the control config in the controllers. If it is generic enough then it won't be bound to knowing the application structure.
That is generic to listen to any tapListingItem event on any dataview (or subclass like List).Code:control : { 'dataview' : { tapListingItem : 'onTapListingItem' } }Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.


Reply With Quote