React UI Events API
The events used to handle user interaction with UI elements.
DevExtreme provides UI events for processing a user's interaction with a specific UI element. The DevExpress.events namespace exposes an API to work with the UI events.
The following code shows how to attach, trigger and then detach a dxhold event handler from a page element with the "target" ID. An extra "timeout" parameter specifies how long the "target" should be held to allow the handler to execute.
var dxholdHandler = function (event) { alert(`The ${event.target.textContent} element is being held for ${event.data.timeout} ms.`); return true; // true - continues event propagation, false - stops. } DevExpress.events.on(document, "dxhold", "#target", { timeout: 1000 }, dxholdHandler); // Without extra parameters // DevExpress.events.on(document, "dxhold", "#target", dxholdHandler); DevExpress.events.trigger(document.getElementById("target"), "dxhold"); DevExpress.events.off(document, "dxhold", "#target", dxholdHandler);
The following code shows how to perform similar tasks using jQuery, AngularJS, or Knockout:
jQuery
var dxholdHandler = function (jQueryEvent) { alert(`The ${$(jQueryEvent.target).text()} element is being held for ${jQueryEvent.data.timeout} ms.`); }; $("#target").on("dxhold", { timeout: 1000 }, dxholdHandler); // Without extra parameters // $("#target").on("dxhold", dxholdHandler); $("#target").trigger("dxhold"); $("#target").off("dxhold", dxholdHandler);
See jQuery documentation for details.
Knockout
<div id="target" data-bind="dxhold: { execute: dxholdHandler, timeout: 1000 }"> Target element </div> <!-- Without extra parameters --> <!-- <div id="target" data-bind="dxhold: dxholdHandler"> Target element </div> -->
var viewModel = { dxholdHandler: function (viewModel, jQueryEvent) { alert(`The ${$(jQueryEvent.target).text()} element is being held for ${jQueryEvent.data.timeout} ms.`); } }
See Knockout documentation for details.
AngularJS
<div id="target" dx-hold="{ execute: 'dxholdHandler($event)', timeout: 1000 }"> Target element </div> <!-- Without extra parameters --> <!-- <div id="target" dx-hold="dxholdHandler($event)"> Target element </div> -->
angular.module('DemoApp', ['dx']) .controller('DemoController', function DemoController($scope) { $scope.dxholdHandler = function (jQueryEvent) { alert(`The ${$(jQueryEvent.target).text()} element is being held for ${jQueryEvent.data.timeout} ms.`); } });
dxclick
Raised when the element is clicked.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery.
The native click event waits 300 ms after the element was clicked. This time interval is required to wait for the second click. If a user clicks the element one more time during this time span, the dblclick event is raised instead of the click. The dxclick event is raised immediately after the element is clicked.
See Also
dxcontextmenu
Raised when the right mouse button is clicked on the element or when the element is held during a specified time period.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery.
See Also
dxdblclick
Raised when a user has performed a double click on the element.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery.
See Also
dxdrag
Raised when the drag gesture has been performed.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following fields are added to existing fields of this argument object.
See Also
dxdragend
Raised when the drag gesture has been completed.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following fields are added to existing fields of this argument object.
See Also
dxdragenter
Raised when a user moves the pointer into the element, provided that the drag gesture is being performed.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following field is added to existing fields of this argument object.
Name | Type | Description |
---|---|---|
draggingElement |
The element being dragged. |
See Also
dxdragleave
Raised when a user moves the pointer out of the element, provided that the drag gesture is being performed.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following field is added to existing fields of this argument object.
Name | Type | Description |
---|---|---|
draggingElement |
The element being dragged. |
See Also
dxdragstart
Raised when the drag gesture has been started.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following field is added to existing fields of this argument object.
Name | Type | Description |
---|---|---|
cancel |
Allows you to cancel the gesture processing. |
See Also
dxdrop
Raised when dragged data has been dropped on the element.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following field is added to existing fields of this argument object.
Name | Type | Description |
---|---|---|
draggingElement |
The element being dragged. |
See Also
dxhold
Raised when the element is being held during a specified time.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery.
To specify the time span after which the event is raised, pass the object containing the timeout property to the function subscribing to the event.
$("#myElement").on("dxhold", { timeout: 1000 }, function() { alert("The element is being held during 1000 milliseconds"); });
See Also
dxhoverend
Raised when the mouse pointer leaves the element.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery.
See Also
dxhoverstart
Raised when the mouse pointer appears over the element.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery.
See Also
dxpinch
Raised when the pinch gesture has been performed.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following fields are added to existing fields of this argument object.
See Also
dxpinchend
Raised when the pinch gesture has been completed.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following fields are added to existing fields of this argument object.
See Also
dxpinchstart
Raised when the pinch gesture has been started.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following field is added to existing fields of this argument object.
Name | Type | Description |
---|---|---|
cancel |
Allows you to cancel the gesture processing. |
See Also
dxpointercancel
Raised when the browser decides that the pointer is unlikely to produce any more events.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following field is added to existing fields of this argument object.
Name | Type | Description |
---|---|---|
pointerType |
The type of the device that raised the event: mouse, pen or touch. |
The event can be raised because of a hardware event; such as, if a device changes the screen orientation while the pointer is active or the number of simultaneous pointers exceeds the supported number, etc.
See Also
dxpointerdown
Raised when the pointer takes on the active buttons state.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following field is added to existing fields of this argument object.
Name | Type | Description |
---|---|---|
pointerType |
The type of the device that raised the event: mouse, pen or touch. |
For a mouse pointer, this event is raised when the mouse state changes from no buttons pressed to at least one button pressed. For touch and pen pointers, the event is raised when physical contact is made with the digitizer.
See Also
dxpointerenter
Raised when a pointer is moved to either the hit test area of an element or one of its descendants.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following field is added to existing fields of this argument object.
Name | Type | Description |
---|---|---|
pointerType |
The type of the device that raised the event: mouse, pen or touch. |
See Also
dxpointerleave
Raised when a pointer is moved from either the hit test area of an element or one of its descendants.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following field is added to existing fields of this argument object.
Name | Type | Description |
---|---|---|
pointerType |
The type of the device that raised the event: mouse, pen or touch. |
See Also
dxpointermove
Raised when any pointer parameter has been changed. (Position, tilt, pressure, button state, or contact geometry).
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following field is added to existing fields of this argument object.
Name | Type | Description |
---|---|---|
pointerType |
The type of the device that raised the event: mouse, pen or touch. |
See Also
dxpointerout
Raised when a pointer is moved from either the hit test area of an element or one of its descendants.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following field is added to existing fields of this argument object.
Name | Type | Description |
---|---|---|
pointerType |
The type of the device that raised the event: mouse, pen or touch. |
See Also
dxpointerover
Raised when a pointer is moved to the hit test area of an element or one of its descendants.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following field is added to existing fields of this argument object.
Name | Type | Description |
---|---|---|
pointerType |
The type of the device that raised the event: mouse, pen or touch. |
See Also
dxpointerup
Raised when the pointer loses the active buttons state.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following field is added to existing fields of this argument object.
Name | Type | Description |
---|---|---|
pointerType |
The type of the device that raised the event: mouse, pen or touch. |
For a mouse pointer, this event is raised when the mouse state changes from at least one button pressed to no buttons pressed. For touch and pen pointers, the event is raised when physical contact is removed from the digitizer.
See Also
dxremove
Raised when a widget associated with an element is being removed from the DOM.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery.
See Also
dxrotate
Raised when the rotate gesture has been performed.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following fields are added to existing fields of this argument object.
See Also
dxrotateend
Raised when the rotate gesture has been completed.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following fields are added to existing fields of this argument object.
See Also
dxrotatestart
Raised when the rotate gesture has been started.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following field is added to existing fields of this argument object.
Name | Type | Description |
---|---|---|
cancel |
Allows you to cancel the gesture processing. |
See Also
dxswipe
Raised when the swipe gesture has been performed.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following fields are added to existing fields of this argument object.
The event supports the direction option that specifies whether the event is raised for horizontal or vertical scrolling. The option can take on the "vertical" and "horizontal" values. The default option value is "horizontal".
See Also
dxswipeend
Raised when the swipe gesture is finished.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following fields are added to existing fields of this argument object.
The event supports the direction option, which specifies whether the event is raised for horizontal or vertical scrolling. The option can take on the "vertical" and "horizontal" values. The default option value is "horizontal".
See Also
dxswipestart
Raised when the swipe gesture is started.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following field is added to existing fields of this argument object.
Name | Type | Description |
---|---|---|
cancel |
Allows you to cancel the gesture processing. |
The event supports the direction option, which specifies whether the event is raised for horizontal or vertical scrolling. The option can take on the "vertical" and "horizontal" values. The default option value is "horizontal".
See Also
dxtransform
Raised when the transform gesture has been performed.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following fields are added to existing fields of this argument object.
Name | Type | Description |
---|---|---|
scale |
The ratio between the current and initial scales. |
|
deltaScale |
The ratio between the current and previous scales. |
|
rotation |
The rotation angle between the initial and current position. |
|
deltaRotation |
The rotation angle between the previous and current position. |
|
translation |
The distance between the initial and current position. |
|
deltaTranslation |
The distance between the previous and current position. |
|
cancel |
Allows you to cancel the gesture processing. |
See Also
dxtransformend
Raised when the transform gesture has been completed.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following fields are added to existing fields of this argument object.
Name | Type | Description |
---|---|---|
scale |
The ratio between the current and initial scales. |
|
deltaScale |
The ratio between the current and previous scales. |
|
rotation |
The rotation angle between the initial and current position. |
|
deltaRotation |
The rotation angle between the initial and previous position. |
|
translation |
The distance between the initial and current position. |
|
deltaTranslation |
The distance between the previous and current position. |
|
cancel |
Allows you to cancel the gesture processing. |
See Also
dxtransformstart
Raised when the transform gesture has been started.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following field is added to existing fields of this argument object.
Name | Type | Description |
---|---|---|
cancel |
Allows you to cancel the gesture processing. |
See Also
dxtranslate
Raised when the translate gesture has been performed.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following fields are added to existing fields of this argument object.
See Also
dxtranslateend
Raised when the translate gesture has been completed.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following fields are added to existing fields of this argument object.
See Also
dxtranslatestart
Raised when the translate gesture has been started.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following field is added to existing fields of this argument object.
Name | Type | Description |
---|---|---|
cancel |
Allows you to cancel the gesture processing. |
See Also
dxzoom
Use the dxpinch event instead.
Raised when the zoom gesture has been performed.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following fields are added to existing fields of this argument object.
See Also
dxzoomend
Use the dxpinchend event instead.
Raised when the zoom gesture has been completed.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following fields are added to existing fields of this argument object.
See Also
dxzoomstart
Use the dxpinchstart event instead.
Raised when the zoom gesture has been started.
Event
Event (jQuery or EventObject)
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. The following fields are added to existing fields of this argument object.
Name | Type | Description |
---|---|---|
cancel |
Allows you to cancel the gesture processing. |
See Also
If you have technical questions, please create a support ticket in the DevExpress Support Center.