Results 1 to 4 of 4

Thread: [FIXED-515] Component doesn't destroy its Scroller

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Jan 2008
    Location
    Toronto, Canada
    Posts
    481

    Default [FIXED-515] Component doesn't destroy its Scroller

    This one took me literally hours to find. When a scrollable Component is removed from a Container, its configured Scroller is never destroyed, so all its listeners just keep firing. I came across it in Chrome when I resized the debugging console. I received whole flood of errors.

    Here's an example:
    Code:
    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <title>test</title>
        <link rel="stylesheet" type="text/css" href="/touch/resources/css/sencha-touch.css" />
        <script type="text/javascript" src="/touch/sencha-touch-debug.js"></script>
        <script type="text/javascript">
            Ext.setup({
                onReady: function() {
                    var cardPanel;
                    
                    // adds a scrollable component to the card panel and activates it
                    var addItem = function() {
                        cardPanel.add({
                            xtype: 'component',
                            html: 'Added scrollable card. Now tap the Remove button.',
                            scroll: true
                        });
                        cardPanel.layout.next();
                    };
                    
                    // removes the previously added scrollable component from the card panel
                    var removeItem = function() {
                        cardPanel.layout.prev();
                        cardPanel.remove(cardPanel.layout.getNext());
                    };                
                    
                    cardPanel = new Ext.Panel({
                        fullscreen: true,
                        layout: 'card',
                        dockedItems: {
                            dock: 'top',
                            xtype: 'toolbar',
                            items: [{
                                text: 'Add',
                                handler: addItem
                            }, {
                                text: 'Remove',
                                handler: removeItem
                            }]
                        },
                        items: [{
                            xtype: 'component',
                            html: 'Main card. Tap the Add button now.'
                        }]
                    });
                }
            });
        </script>
    </head>
    <body>
    </body>
    </html>
    For now to make my code work I'm using this override.
    Code:
    Ext.override(Ext.Component, {
        onDestroy : function() {
            if (this.monitorOrientation && Ext.EventManager.orientationEvent) {
                Ext.EventManager.orientationEvent.removeListener(this.setOrientation, this);
            }
            
            if (this.scroller) {
                Ext.destroy(this.scroller);
            }
            
            Ext.Component.superclass.onDestroy.call(this);
        }
    });
    Please fix this. Thank you.

    While at it, there's a typo in /widgets/Component.js line 554
    this.scroler = null; should say this.scroller = null;

  2. #2
    Sencha User
    Join Date
    Aug 2010
    Posts
    534

    Default

    What version are you using?

  3. #3
    Sencha User
    Join Date
    Jan 2008
    Location
    Toronto, Canada
    Posts
    481

    Default

    0.99

  4. #4
    Sencha Premium User
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258

    Default

    Thanks, fixed this up.

Similar Threads

  1. Replies: 1
    Last Post: 27 Jul 2010, 10:08 AM
  2. [FIXED-104] Carousel.add/dolayout doesn't update scroller bounds
    By Iumentum in forum Sencha Touch 1.x: Bugs
    Replies: 2
    Last Post: 28 Jun 2010, 1:57 PM
  3. Replies: 3
    Last Post: 3 Feb 2010, 9:14 AM
  4. [Bug?] Ext.Component doesn't destroy context menus?
    By mjlecomte in forum Ext 2.x: Help & Discussion
    Replies: 8
    Last Post: 18 Dec 2008, 3:26 PM
  5. Replies: 2
    Last Post: 10 Sep 2008, 11:50 PM

Posting Permissions

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