-
18 Nov 2012 5:12 PM #1
Unanswered: Performance consideration: refs vs componentquery
Unanswered: Performance consideration: refs vs componentquery
I was just wondering whether its always faster to use refs instead of using componentquery if you are only referencing the item a single time in a controller. I assume that refs use componentquery anyway, but I guess I'm asking whether any cpu cycles are saved by using refs as opposed to just using componentquery
-
20 Nov 2012 5:51 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
- Answers
- 3113
Yes, refs do use ComponentQuery to lookup and starts at the top and works it's way down and finds all instances matching your selector and then uses the first. This can be bad performance depending how many components you have instantiated.
Another way is to start at a component and walk up/down to get the reference you are wanting. You can then set that instance as a property to reference whenever.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.
-
23 Nov 2012 4:49 AM #3
Example plese
Example plese
So could I ref one item and use this ref as a starting ref inside the ref config?
This could be helpful to use shorter itemIds as we usually do the following:
So - if I could start the btn ref with at the currentView level, that could help.Code:refs:{ currentView: '#myView', btnOnView: '#myView #btnOnView' }


Reply With Quote