Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-3805 in a recent build.
  1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    13
    Vote Rating
    1
    artsiom_aliakseyenka is on a distinguished road

      0  

    Default ListItem doesn't destroy its header element

    ListItem doesn't destroy its header element


    REQUIRED INFORMATION




    Ext version tested:
    • Sencha Touch 2.1
    Browser versions tested against:
    • Chrome 23(Windows)
    Description:
    • Ext.List component consists of Ext.dataview.component.ListItem components.
    • Every ListItem contains three elements: body, dislosure, header.
    • When ListItem is created, it places body and dislosure in the items collection. But header is simply inserted in dom.
    • When list is created with some data populated, then we have no any problems.
    • But when list created empty, without data or store, then we have following problem:
      • List subscribed on resize event.
      • When resize is fired(it always fired, even if window size wasn't changed), the list, when it is empty, adds empty items.
      • If after that we destroy list, the header items for every list item element are not destroyed.
      • This also happens when, after creating empty, list was populated with data, and then destroyed. Those empty list items are not fully destroyed
    Steps to reproduce the problem:
    • Create empty List
    • Let resize event to be fired, wait some time
    • Destroy List and check Ext.StoreManager.map, you will find there header components, which are not destroyed, although list is destoyed
    The result that was expected:
    • ListItem should destroy its header
    The result that occurs instead:
    • ListItem's header is not destroyed
    Test Case:


    Code:
            var list = Ext.create('Ext.List', {
                fullscreen: true,
                itemTpl: '{title}'
            });
    
    
            setTimeout(function(){
                list.destroy();
                console.log(Ext.ComponentManager.map); // contains several ext-component, which are the listitem's header
            },1000);
    Last edited by mitchellsimoens; 7 Dec 2012 at 7:10 AM. Reason: fix test case

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


    The reason for the header is since the list supports infinite dataset, you never know which row will need to show a header. So as you scroll a header may need to be shown on any of the list items so they need to be there.
    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
    Dec 2012
    Posts
    13
    Vote Rating
    1
    artsiom_aliakseyenka is on a distinguished road

      0  

    Default


    Yeap, i understand this. But this doesn't explain why headers are not destroyed. If they would be never destroyed , we will have a leak.

  4. #4
    Sencha User
    Join Date
    Dec 2012
    Posts
    13
    Vote Rating
    1
    artsiom_aliakseyenka is on a distinguished road

      0  

    Default


    Mitchell, i mean the following. Lists in most cases will be created empty. And the headers created for empty list items elements, which i described above, will be never destroyed. In case we have many lists, or list is repeatedly created/destroyed, the memory will grow, this causes memory leak.

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


    I see the issue with your test case, you were looking at StoreManager not ComponentManager.
    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.

  6. #6
    Sencha User
    Join Date
    Dec 2012
    Posts
    13
    Vote Rating
    1
    artsiom_aliakseyenka is on a distinguished road

      0  

    Default


    Oh, sorry, my mistake

Thread Participants: 1