Results 1 to 4 of 4

Thread: [6.2.0 Modern] Removing items from Carousel throws error on second remove

    You found a bug! We've classified it as EXTJS-22671 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha Premium User
    Join Date
    Mar 2015
    Posts
    6

    Default [6.2.0 Modern] Removing items from Carousel throws error on second remove

    Ext version tested:
    • Ext 6.2.0

    Browser versions tested against:
    • Chrome

    Description:
    • Removing items from Ext.carousel.Carousel throws an error on the second call to removeAt(idx).

    Steps to reproduce the problem:
    • Load the fiddle
    • Scroll through the carousel to the end panel
    • Scroll backwards through the carousel to the start. The carousel will 'pop' the last shown panel, like a 'stack' of panels.
    • On the second call to removeAt(idx), an error will be thrown, breaking the app
    • The error is: Uncaught TypeError: component.getId is not a function

  2. #2
    Sencha Premium User
    Join Date
    Mar 2015
    Posts
    6

    Default

    Further to the above message, we think it may be caused by the following in Ext.container.Container:

    Code:
    doRemove: function(item, index, destroy) {
        var me = this;
    
        me.items.remove(item);
    
        if (item.isInnerItem()) {
            me.removeInner(item);
        }
    
        me.onItemRemove(item, index, destroy);
    
        item.onRemoved(item.destroying || destroy);
    
        if (destroy) {
            item.destroy();
        }
    }
    And the following from Ext.carousel.Carousel:

    Code:
    onItemRemove: function(item, index) {
        this.callParent(arguments);
    
        var innerIndex = this.getInnerItems().indexOf(item),
             indicator = this.getIndicator(),
             carouselItems = this.carouselItems,
             i, ln, carouselItem;
    
    ....
    As you can see, the container removes the item from innerItems and then calls onItemRemove. This means the value of innerIndex in onItemRemove is always -1.
    Last edited by ega04trt; 14 Sep 2016 at 10:50 AM. Reason: Code formatting tweaks

  3. #3
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,256

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

  4. #4
    Sencha User
    Join Date
    Dec 2007
    Posts
    52

    Default

    @ega04trt : yes, innerIndex is always -1.

    And as a temporary quick fix, one can set the undocumented config option bufferSize to 0:
    {
    xtype: 'carousel',
    bufferSize: 0
    }

    Works for the fiddle and for my app, though may be at the expense of some performance.

Similar Threads

  1. [FIXED] Modern: Removing items from grouped list throws an error
    By teemu_ in forum Ext JS 6.x Bugs
    Replies: 2
    Last Post: 7 Sep 2016, 2:52 PM
  2. Replies: 5
    Last Post: 18 Apr 2012, 5:58 AM
  3. Error occuring while removing items from carousel component!!!
    By pm.sreejith in forum Sencha Touch 2.x: Discussion
    Replies: 3
    Last Post: 17 Apr 2012, 9:54 AM
  4. Adding items dynamically into a carousel throws an error
    By Chirieac in forum Sencha Touch 1.x: Discussion
    Replies: 1
    Last Post: 18 Jun 2011, 3:14 AM

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
  •