tags:

views:

48

answers:

1

I have been following:

http://www.sencha.com/learn/Tutorial:Introduction_to_Ext_2.0

And using the following example:

Ext.onReady(function() {
    var paragraphClicked = function(e) {
        Ext.get(e.target).highlight();
    }
    Ext.select('p').on('click', paragraphClicked);
});

I am using something very similar:

   Ext.onReady(function() {
        var paragraphClicked = function(e) {
            Ext.get(e.target).addClass('product-selected');
        }
        Ext.select('.product').on('click', paragraphClicked);
    });

However it does not appear to work correctly. e.target appears to return the ext viewport object.

I am actually using Ext 3 not 2 so I guess there must be differences.

A: 

I never used e.target, always e.getTarget().

Maybe you can try e.getTarget(".product") ? Or maybe you can play with the delegate options of addListener in Ext.Element.

Drasill