1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    77
    Vote Rating
    2
    Answers
    6
    azamatoak is on a distinguished road

      0  

    Default Unanswered: Duplicate DOM elements by including view by xtype in two different views

    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.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    898
    Answers
    3575
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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 Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

Tags for this Thread