Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-1773 in a recent build.
  1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    46
    Vote Rating
    1
    gubarez is on a distinguished road

      0  

    Default Beta1: Carousel not removing items properly

    Beta1: Carousel not removing items properly


    Hi,

    I am having a dynamically *updated* carousel. The problem comes when I want to remove all the items and add other.
    If I use carousel.removeAll() I get this error: Uncaught Error: NOT_FOUND_ERR: DOM Exception 8

    it can be fixed in the following way:
    Code:
    for (var i=0; i<carousel.getItems().length;i++ )
                carousel.removeAt(1, true);
    carousel.add(items);
    carousel.setActiveItem(0);

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


    This is working with no problems for me:

    Code:
    var carousel = new Ext.carousel.Carousel({
        fullscreen : true,
        items      : [
            {
                html : 'one'
            },
            {
                html : 'two'
            },
            {
                xtype  : 'toolbar',
                docked : 'top',
                items  : [
                    {
                        text    : 'Remove All',
                        handler : function() {
                            carousel.removeAll();
                        }
                    }
                ]
            }
        ]
    });
    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
    Jun 2011
    Posts
    46
    Vote Rating
    1
    gubarez is on a distinguished road

      0  

    Default


    Hi, I have the following:

    Code:
    Ext.define('Myapp.view.MyCarousel', {
        extend: 'Ext.Container',
        
        config: {
            layout: 'vbox',
            items: [
               {
                    itemId: 'id1',
                    xtype: 'carousel',
                    direction: 'horizontal',
                    directionLock: true,
                    flex: 1,
                    items: []
                },
                {
                    itemId: 'id2',
                    xtype: 'carousel',
                    direction: 'vertical',
                    directionLock: true,
                    flex: 3,
                    items: []
                }
            ]
        },
    });
    in the controller I have
    Code:
    ....
    myfunc: function ()
    {
                var items= [
                {
                    xtype: 'panel',
                    html: "text1"
                },
                {
                    xtype: 'panel',
                    html: "text2"
                }
            ];
            
            var carousel = Ext.getCmp('id2');
            
            console.log(carousel);
    
            carousel.removeAll();
    
    
            //for (var i=0; i<carousel.getItems().length;i++ )
           //     carousel.removeAt(1, true);
    
    
            carousel.add(items);
            
            carousel.setActiveItem(0);
    }
    ....

  4. #4
    Sencha - Sencha Touch Dev Team Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    20
    Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough

      0  

    Default


    Thank you for the test case.

    Sencha Inc

    Jamie Avins

    @jamieavins

  5. #5
    Sencha - Sencha Touch Dev Team Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    20
    Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough

      0  

    Default


    I can't reproduce your error given the test case in PR4, beta1, or the current head. One thing you might be running into is by not using removeAll you risk removing the indicator which you surely don't want to do.

    Sencha Inc

    Jamie Avins

    @jamieavins

  6. #6
    Sencha User
    Join Date
    Jun 2011
    Posts
    46
    Vote Rating
    1
    gubarez is on a distinguished road

      0  

    Default


    I believe, the indicator is destroyed indeed... Strange you can't reproduce it... This is part of an app of which the
    Myapp.view.MyCarousel
    container is *later* created as part of a layout: card Panel into the viewport after a user activity. So, may be the bug occurs in this particular case.

  7. #7
    Sencha User
    Join Date
    Dec 2011
    Posts
    9
    Vote Rating
    0
    maxgr is on a distinguished road

      0  

    Default


    I have the same problem, I can't make my dynamic carousel work in any way, I get the same DOM error. I can post snippets from my code but the problem is essentially the same one presented by the original poster.

  8. #8
    Sencha - Sencha Touch Dev Team Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    20
    Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough

      0  

    Default


    Quote Originally Posted by maxgr View Post
    I have the same problem, I can't make my dynamic carousel work in any way, I get the same DOM error. I can post snippets from my code but the problem is essentially the same one presented by the original poster.
    If you can post a reproducible test case on a new thread, that would be great.

    Sencha Inc

    Jamie Avins

    @jamieavins