31 May 2012 2:57 AM #1
Good practice with Ext.define for views
If I have an Ext.Container component created using Ext.define and am using animateActiveItem to push another component upon it, something like an Ext.List component is it normal behaviour for it for the sub component being pushed to be created each time it is pushed?
Within the sub component, if I add a listener for 'painted' and then do a count on the array returned from Ext.ComponentQuery.query('listcomponentpanel') the count increments every time the list component is pushed using animateActiveItem.
This had been causing trouble in an app I was working on so what I have done is added an 'erased' listener to the listcomponentpanel to call this.destroy() every time it is erased. Is this good practice ?
3 Jun 2012 1:28 PM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
Are you creating a new list everytime? You need to check if the list exists and if not then create a new list. Pass the list to animateActiveItem then.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 firstname.lastname@example.org
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.
5 Jun 2012 1:13 AM #3
Yeah it looks like I'm creating a new list every time that function is called. I'll do a check and create if it's null or undefined.