21 Mar 2013 10:01 AM #1
Unanswered: Duplicate DOM elements by including view by xtype in two different views
I have an app that launches a view by xtype on startup to get the user to sign up. This view has some selectfields and all works as expected. The use also has the option to skip this view and access it later. When the user accesses this view at a later time, I have an issue where data is not being appended to the correct elements. The values are being set but running Ext.ComponentQuery.query('[itemId=item_name]') returns 2 elements. Somehow the elements of this view are getting duplicated.
I have also tried setting autoDestroy: true on the config for this view but this has no effect whatsoever.
I have also tried manually destroying the view using destroy() method on the deactivate() event. When I do this, the behavior turns strange and selecting an item from another pushed view and returning back to the profile screen causes the navigationview to break as if this view is not present. The header of the navigationbar breaks and the back button is incorrectly shown.
Why are the view elements being duplicated? How can I prevent this.
23 Mar 2013 5:38 AM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
On the deactivate event, if you destroy() it by default it will be destroyed and removed from the parent. So if you try to go back to the view and create a new instance you should only have one.
It's kind of hard to help you without any code or anything.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.