Native events supported by sencha touch

Source: Internet
Author: User

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 );

}
});

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.