Results 1 to 5 of 5

Thread: Best practice to destroy views on pop()

  1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    22
    Answers
    1
    Vote Rating
    0
      0  

    Default Answered: Best practice to destroy views on pop()

    Hello I was wondering what is the best practice to destroy views on pop from a navigationView

    i think listening for the pop event and then calling a function
    onPop: function(thisNav, view){
    thisNav.remove(view, true);
    }

    would work, but i am unsure if there is a recomended way of destroying views that get popped out of the navigationView

    thanks in advance for any tips

  2. as long as autoDestroy is true on the child items (which it is true by default) then when you pop or press the back button on the navigation view it will remove the item and therefore automatically destroying it.

  3. #2
    Sencha Premium Member
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    587
    Answers
    25
    Vote Rating
    88
      0  

    Default

    I'm very interested to learn the best practice here.

    I defer a function by a second which then destroys the view but I don't like this.

    Ideally they'd be an event that fires like "afterdeactivate" or something that we could use to destroy the view; currently deactivate fires at the start of the animation, when the view is still required - not at the end of the animation when the view has completely left the viewport.

  4. #3
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    as long as autoDestroy is true on the child items (which it is true by default) then when you pop or press the back button on the navigation view it will remove the item and therefore automatically destroying it.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  5. #4
    Sencha User
    Join Date
    Apr 2012
    Posts
    22
    Answers
    1
    Vote Rating
    0
      0  

    Default

    thanks, i didn't know that remove was called automatically when a view is popped, so theres no need write an extra function for the pop event

  6. #5
    Sencha Premium User
    Join Date
    Feb 2012
    Location
    Berne, Switzerland
    Posts
    723
    Answers
    42
    Vote Rating
    46
      0  

    Default

    Quote Originally Posted by mitchellsimoens View Post
    as long as autoDestroy is true on the child items (which it is true by default) then when you pop or press the back button on the navigation view it will remove the item and therefore automatically destroying it.
    Good to know that! Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •