Prevent Carousel scroll within scrollable Container (Sencha 2)?

Posted by TragedyStruck on Stack Overflow See other posts from Stack Overflow or by TragedyStruck
Published on 2012-07-17T11:14:39Z Indexed on 2012/11/27 11:04 UTC
Read the original article Hit count: 239

I've got a Container with a header, content (Carousel) and a footer. The Container itself is therefor scrollable (vertical) to be able to scroll down to the footer. The Carousel can be swiped horizontally to change active item. I want to lock it to do only two thing:

  • If starting to move vertically, only scroll Container
  • If starting to move horizontally, only scroll Carousel

If you now grab the Carousel you are able to scroll both ways at the same time. Example code:

Ext.define('MyApp.view.MyContainer', {
    extend: 'Ext.Container',

    config: {
        scrollable: true,
        items: [
            {
                xtype: 'container',
                items: [
                    {
                        xtype: 'label',
                        html: 'abc'
                    }
                ]
            },
            {
                xtype: 'carousel',
                height: 200,
                scrollable: false,
                items: [
                    {
                        xtype: 'label',
                        html: 'x'
                    },
                    {
                        xtype: 'label',
                        html: 'y<br/>y<br/>y<br/>y<br/>y<br/>y<br/>y<br/>y'
                    }
                ]
            },
            {
                xtype: 'container',
                items: [
                    {
                        xtype: 'label',
                        html: 'def'
                    }
                ]
            }
        ]
    }

});

Using Sencha Touch 2.

© Stack Overflow or respective owner

Related posts about sencha-touch

Related posts about sencha