PDA

View Full Version : Help on domevents and el vs body



Veritus
23 Oct 2010, 2:47 AM
Hi guys,

For my current project in need to define an area where the user can perform "swiping" (left or right).

In order to achiev that, i've taken a panel and added a listener for the swipe event. Here the code:



mt.SwipePanel = Ext.extend(Ext.Panel,{

initComponent : function() {

this.layout = {
type: 'hbox'
};

mt.SwipePanel.superclass.initComponent.call(this);

this.setSize(undefined,60);

this.on({
body: {
swipe: function(e) {alert('swiped on body to ' + e.direction);}
},
el: {
doubletap: function(e) {alert('doubletapped on panels el ' + e);}
},
scope: this
});

}

afterRender : function(){
this.mon(
this.el, {
swipe: function(e){alert('test' + e.direction);},
scope: this
}
);
}

});


This works fine but i asked me the question if there is a difference (maybe performance or something) when i use this.on in initComponent or the afterRender event. Furthermore i would appreciate if somebody could explain me the meaning of mon. i know from the forum that i have to use it, but not why. Last but not least: can somebody explain me the difference between body and el? Is body the div container and el the sencha component?

Please enlight me :)

kind regards,