Results 1 to 8 of 8

Thread: container removeAll only removes last added containerBlock

  1. #1
    Sencha User dewil_de's Avatar
    Join Date
    Mar 2012
    Posts
    28
    Vote Rating
    3
      0  

    Default container removeAll only removes last added containerBlock

    Hey,

    I've run into a problem and don't really see a good way out.

    I have a container (vbox) which i populate with another container (dateBlock flex: 1).
    i do this by container.add(dateblock instance).
    When a user clicks a button i want to clear the container and refill it with new dateBlock instances.
    But when i do container.removeAll it only removes the last added item.

    I've tried things like getting all the innerItems and destroying them but that doesn't work either.
    Is there something i'm missing here?

  2. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,029
    Answers
    3976
    Vote Rating
    1367
      0  

    Default

    I use removeAll and it removes everything. I would set a breakpoint on the removeAll and walk through the code.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha User dewil_de's Avatar
    Join Date
    Mar 2012
    Posts
    28
    Vote Rating
    3
      1  

    Default

    Thx for taking your time to look into the problem.

    But i had already solved it, i had declared a itemId on my dateBlock element.

  4. #4
    Sencha Premium Member zmagyar's Avatar
    Join Date
    Mar 2012
    Location
    Budapest
    Posts
    94
    Answers
    1
    Vote Rating
    2
      0  

    Default

    Actually there seems to be a bug here. If there are several items using the same itemId in the container then the item list is failing (contains only one item for the multiplied items). I.e.

    Code:
    for (i=0; i<10; i++) {
       cotainer.add([Ext.create('Ext.Label', {
          html: 'My label index:' + i,
          itemId: 'sameId'
       })]);
    }
    Will display 10 label in the container. However container.getItems() will show that there is only one item in the container. Also container.removeAll() will remove the last added item only.

    As there is no assert fired when the same itemId is used in the same scope (as it happens in case of id) then I would assume no such an important features are dependant on this.

  5. #5
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,029
    Answers
    3976
    Vote Rating
    1367
      0  

    Default

    The error there is duplicate itemIds in the same container. itemIds should be unique in the container.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  6. #6
    Sencha Premium Member zmagyar's Avatar
    Join Date
    Mar 2012
    Location
    Budapest
    Posts
    94
    Answers
    1
    Vote Rating
    2
      0  

    Default

    See last para of the comment. I think if itemId's should be unique then we should have a warning on the console when it is detected.

  7. #7
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,029
    Answers
    3976
    Vote Rating
    1367
      0  

    Default

    Sure but that won't do anything to fix the issue for you. You also need to know what your application is doing so that you can also prevent this from happening.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  8. #8
    Sencha Premium Member zmagyar's Avatar
    Join Date
    Mar 2012
    Location
    Budapest
    Posts
    94
    Answers
    1
    Vote Rating
    2
      0  

    Default

    The whole point is that if you can't find any reference in the documentation that itemId must be unique in the container and there is no warning logged on the console then you will waste reasonable amount of time while find it for yourself.

Tags for this Thread

Posting Permissions

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