As of sencha touch2.1, the following 19 events supported by sencha touch
doubletap drag dragend dragstart longpress painted pinch pinchend pinchstart resize rotate rotateend rotatestart singletap swipe tap taphold touchmove touchstart |
These 19 events are supported by sencha touch to respond to user operations. The objects used are Ext. Dom. element, which can be understood as native events.
In sencha touch, each component provides support for various events. These events act on the component object,
For example, ext. Panel supports 31 events.
If you want to respond to these native events on a component, you can use Ext. Get (COMPID) to obtain the corresponding
Dom element.
Eg: responds to events such as swipe and tap on a view. The events supported by this view do not include swipe and tap.
1. Define view and inherit container
Ext. Define ('touchpad ',{
Extend: 'ext. iner ',
Xtype: 'toucheventpad ',
ID: 'touchpad ', // defines the ID. You can use Ext. Get () to obtain the DOM element of the touchpad.
Config :{
Flex: 1,
Margin: 10,
Layout :{
Type: 'vbox ',
Pack: 'center ',
Align: 'stretch'
},
Items :[
{
HTML: 'touch here! '
}
]
}
});
2. Add listener for touchpad in another view
Ext. Define ('touchevents ',{
Extend: 'ext. iner ',
Xtype: 'touchevents ',
Requires :[
'Touchpad ',
],
Initialize: function (){
This. callparent (arguments );
// Padelement is an Ext. Dom. Element Object.
VaR padelement = ext. Get ('touchpad ');
// Add the listener as ontouchpadevent
Padelement. On (['touchstart', 'touchend', 'touchmove ',
'Swip', 'dragstart', 'drag', 'dragend ',
'Tap', 'doubletap', 'longpres', 'pinch', 'rotate'],
'Ontouchpadevent', this );
},
// Event Response Function
Ontouchpadevent: function (E, target, options, eventcontroller ){
Console. Log (eventcontroller.info. eventname );
}
});