1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    82
    Vote Rating
    3
    matfin is on a distinguished road

      0  

    Default Good practice with Ext.define for views

    Good practice with Ext.define for views


    Hi Folks,

    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 ?

    Thanks

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    899
    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


    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 @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.

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    82
    Vote Rating
    3
    matfin is on a distinguished road

      0  

    Default


    Thanks,

    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.

    Thanks,

    Matt

Thread Participants: 1

Tags for this Thread