1 Aug 2012 3:54 AM #1
Wrong scope in a controllerAction...
Ext version tested:
- Ext 4.0.7-commercial
- FF (newest with firebug)
- Chrome (newest with firebug lite)
- I have a simple Controller with a Panel Reference and a Controller Action.
- Inside the Controller Action "this" = the element not the Controller
- Create a Panel (itemId: navigation)
- Create a Controller
- Create a Controller Reference (ref: navigation; selector: #navigation)
- Create a Controller Action
(controlQuery: navigation; targetType: Ext.panel.Panel; fn:onNavigationResize; name: resize;
- alert(this.getItemId()); in the Controller Action
(the getItemId() returns #navigation...(so the element) but it should be the controller)
- On a TabPanel Action with a Reference (near the same) "this" = the controller not the element
- this in a Controller Action FN should be the controller
- this in a Controller Action FN is the Element
- I can just get the controller with Ext.getController... but thats not what i want...
- Win7 Pro
*EDIT: i found what was wrong... cause i cant use an ItemId in the Controller Action ControlQuery... i used me.getNavigation().on('resize', me.onNavigationResize, this);
now the scope is correct... (red marked)
1 Aug 2012 6:29 AM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
Mitchell Simoens @LikelyMitch
Sencha Inc, Senior Software Engineer
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
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 email@example.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!
When posting code, please use BBCode's CODE tags.
1 Aug 2012 6:37 AM #3