26 Apr 2012 2:41 PM #1
Multiple hidden toolbar buttons vs single dynamically changing button (best practice)
So I'm developing an app based around a navigation view. At various times in the app I'm showing and hiding buttons in the navigationBar. As of now I've created a separate button for each action needed and set it hidden by default, showing/hiding as necessary.
This morning I though of an alternative: Say I had 10 buttons that display in the toolbar at different times throughout my app. I could reduce the numbers of buttons I actually instantiate by reusing buttons that have the same purpose, (a done button for a form for example).
So say I have a 3 done buttons for 3 separate forms. I could essentially use the same button for each form by setting the action of that button to be relevant to the form.
Anyone have any thoughts on what might be better for performance? more buttons super specific, less buttons with dynamically set actions....
28 Apr 2012 4:35 AM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
If you can consolidate number of components you use is very much suggested for performance as long as you don't have to do too much to reuse.
I often use the action custom property on buttons and in the controller have listeners for button with certain actions. This would be very easy to change the action property and set the text.Mitchell Simoens @SenchaMitch
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.