Michael
Michael

Reputation: 7113

Sencha Touch 2.1: Tap event seems only to work with img, but not with a carousel

I build a Carousel containing containers with two items each: an image and a dataview. On click I want to flip the image to show the dataview. My problem is that the tap event doesn't fire on the right element. It fires on an 'img'-element, but not on the carous.

Ext.define('MY.controller.Mycarousel' , {
extend: 'Ext.app.Controller',
requires: [ 'Ext.Img' ],

config: {
    refs: {
        mycarouselView: '#mycarousel',
    },

    control: {
        mycarouselView: {
            activate: 'flipImage',          // works
            tap: 'flipImage',               // doesn't work
        },
        'img': {
            tap: 'flipImage',               // works
        }
    }
},

How can I get the tap event on a carousel view?

I also tried:

Ext.define('MY.controller.Mycarousel' , {
extend: 'Ext.app.Controller',
requires: [ 'Ext.Img' ],

config: {
    refs: {
        myCarouselDataview: 'dataview'
    },

    control: {
        myCarouselDataview: {
            initialize: 'flipImage',     // fires
            itemsingletap: 'flipImage',  // doesn't fire
            itemtap: 'flipImage',        // doesn't fire
            itemtouchstart: 'flipImage'  // doesn't fire
        },
        'img': {
            tap: 'flipImage', // fires
        },
    }
},

If I click on the image, the image is flipped, the dataview appears, shows its html, but if I click on it then no events are fired. That's mysterious to me ...

Upvotes: 0

Views: 1318

Answers (1)

ThinkFloyd
ThinkFloyd

Reputation: 5021

tap on carousel doesn't work because Ext.carousel.Carousel doesn't have any such event:

http://docs.sencha.com/touch/2-1/#!/api/Ext.carousel.Carousel

so tap event must be fired by content of the carousel, which is img in your case.

Upvotes: 1

Related Questions