PDA

View Full Version : Fire Swipe Event



tomalex0
8 Dec 2010, 5:05 AM
Hi

From below mention code, i have mentioned swipe event for panel element and also an activate for panel.



new Ext.Panel({
id:'textid',
fullscreen:true,
renderTo:Ext.getBody(),
html:'Thomas <br>sdfssdf',
listeners:{
activate:function(){
console.log("activated")
},
el:{
swipe:function(){
console.log("swiped");
}
}
}
});




Using


Ext.getCmp('textid').fireEvent('activate');

we can fire activate event.

How can we fire swipe event ?

tomalex0
10 Dec 2010, 10:14 PM
Could someone have reply?

mrsunshine
11 Dec 2010, 3:16 AM
indeed good question, i tried a bunch of things and got it not working

mrsunshine
11 Dec 2010, 3:20 AM
found a way to get it working
hope thats help you



Ext.setup({
onReady: function() {
var cmp = new Ext.Panel({
id:'textid',
fullscreen:true,
renderTo:Ext.getBody(),
html:'Thomas <br>sdfssdf',
listeners:{
activate:function(){
console.log("activated")
}
}
});

var el = Ext.apply(cmp.getEl(), new Ext.util.Observable());
el.on('swipe',function(){
console.log(this, "swiped");
})

cmp.fireEvent('activate');

el.fireEvent('swipe');
}
});

tomalex0
11 Dec 2010, 5:08 AM
Just a doubt, i was able to fire "swipe" event.

with

el.fireEvent('swipe');
But swipe was not fired with mouse or touch actions?

Hope you understood what i meant .

trkaky
23 Jan 2012, 4:03 PM
listeners: {
swipe:{
element: 'el',
fn: function(evt,el){
console.log('swiped');
}
}
}