Vue 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. The timeout parameter specifies how long the target should be held to allow the handler to execute:

jQuery
JavaScript
var dxholdHandler = function(jQueryEvent) {
    alert(`The ${$(jQueryEvent.target).text()} element was held for ${jQueryEvent.data.timeout} ms.`);
};

$("#target").on("dxhold", { timeout: 1000 }, dxholdHandler); 
$("#target").trigger("dxhold");
$("#target").off("dxhold", dxholdHandler);

See jQuery documentation for details.

Angular
JavaScript
import { on, trigger, off } from "devextreme/events";
// ...
export class AppComponent implements AfterViewInit {
    ngAfterViewInit() {
        const dxholdHandler = (event) => {
            alert(`The ${event.target.textContent} element was held for ${event.data.timeout} ms.`);
            return true; // true - continues event propagation, false - stops
        }
        const target: HTMLElement = document.getElementById("target");

        on(target, "dxhold", { timeout: 1000 }, dxholdHandler);
        trigger(target, "dxhold");
        off(target, "dxhold", dxholdHandler);
    }
}
Knockout
HTML
JavaScript
<div id="target" data-bind="dxhold: { execute: dxholdHandler, timeout: 1000 }">
    Target element
</div>
var viewModel = {
    dxholdHandler: function(viewModel, jQueryEvent) {
        alert(`The ${$(jQueryEvent.target).text()} element was held for ${jQueryEvent.data.timeout} ms.`);
    }
}
NOTE
Knockout does not provide an API to unsubscribe from an event.

See Knockout documentation for details.

AngularJS
HTML
JavaScript
<div id="target" dx-hold="{ execute: 'dxholdHandler($event)', timeout: 1000 }">
    Target element
</div>
angular.module("DemoApp", ["dx"])
    .controller("DemoController", function DemoController($scope) {
        $scope.dxholdHandler = function(jQueryEvent) {
            alert(`The ${$(jQueryEvent.target).text()} element was held for ${jQueryEvent.data.timeout} ms.`);
        }
    });
NOTE
AngularJS does not provide an API to unsubscribe from an event.

dxclick

Raised when the element is clicked.

Module: events/click
Type:

Event

Function parameters:
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.

Type:

Event

Function parameters:
event:

Event (jQuery or EventObject)

The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery.

dxdblclick

Raised when a user has performed a double click on the element.

Module: events/dblclick
Type:

Event

Function parameters:
event:

Event (jQuery or EventObject)

The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery.

dxdrag

Raised when the drag gesture has been performed.

Module: events/drag
Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
offset

Number

The ratio between the drag distance and the target element's width.

cancel

Boolean

Allows you to cancel the gesture processing.

dxdragend

Raised when the drag gesture has been completed.

Module: events/drag
Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
offset

Number

The ratio between the drag distance and the target element's width.

cancel

Boolean

Allows you to cancel the gesture processing.

dxdragenter

Raised when a user moves the pointer into the element, provided that the drag gesture is being performed.

Module: events/drag
Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
draggingElement

DOM Node

The element being dragged.

dxdragleave

Raised when a user moves the pointer out of the element, provided that the drag gesture is being performed.

Module: events/drag
Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
draggingElement

DOM Node

The element being dragged.

dxdragstart

Raised when the drag gesture has been started.

Module: events/drag
Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
cancel

Boolean

Allows you to cancel the gesture processing.

dxdrop

Raised when dragged data has been dropped on the element.

Module: events/drag
Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
draggingElement

DOM Node

The element being dragged.

dxhold

Raised when the element was held for a specified time. The default time interval is 750 ms.

Module: events/hold
Type:

Event

Function parameters:
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 that subscribes to the event.

If you need to subscribe to dxhold for two elements that are in the parent-child relationship, make sure that the timeout of the parent element is equal or longer than that of the child. dxhold triggers when The following example illustrates the case, where the parent's timeout is longer:

jQuery
index.html
index.js
index.css
<div id="parent">
    Parent element
    <div id="child">
        Child element
    </div>
</div>
$(function() {
    var dxholdHandler = function() {
        alert(`${event.data.elemName} was held for ${event.data.timeout} ms.`);
        return true; // true - continues event propagation, false - stops
    });

    $("#parent").on("dxhold", { timeout: 1000, elemName: 'Parent' }, dxholdHandler);
    $("#child").on("dxhold", { timeout: 750, elemName: 'Child' }, dxholdHandler);
});
#parent {
    background-color: aquamarine;
    width: 250px;
    height: 150px;
}

#child {
    background-color: bisque;
    width: 180px;
    height: 100px;
}
Angular
app.component.html
app.component.ts
app.component.css
<div id="parent">
    Parent element
    <div id="child">
        Child element
    </div>
</div>
import { Component, AfterViewInit } from '@angular/core';
import { on } from 'devextreme/events';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent implements AfterViewInit {
    ngAfterViewInit() {
        const dxholdHandler = (event) => {
            alert(`${event.data.elemName} was held for ${event.data.timeout} ms.`);
            return true; // true - continues event propagation, false - stops
        }
        const parent: HTMLElement = document.getElementById("parent");
        const child: HTMLElement = document.getElementById("child");

        on(parent, "dxhold", { timeout: 1000, elemName: 'Parent' }, dxholdHandler);
        on(child, "dxhold", { timeout: 750, elemName: 'Child' }, dxholdHandler);
    }
}
#parent {
    background-color: aquamarine;
    width: 250px;
    height: 150px;
}

#child {
    background-color: bisque;
    width: 180px;
    height: 100px;
}
Vue
App.vue
<template>
<div id="parent">
    Parent element
    <div id="child">
        Child element
    </div>
</div>
</template>

<script>
import { on } from 'devextreme/events';

export default {
    mounted() {
        const dxholdHandler = (event) => {
            alert(`${event.data.elemName} was held for ${event.data.timeout} ms.`);
            return false; // true - continues event propagation, false - stops
        }
        const parent = document.getElementById("parent");
        const child = document.getElementById("child");

        on(parent, "dxhold", { timeout: 1000, elemName: 'Parent' }, dxholdHandler);
        on(child, "dxhold", { timeout: 750, elemName: 'Child' }, dxholdHandler);
    }
};
</script>

<style>
#parent {
    background-color: aquamarine;
    width: 250px;
    height: 150px;
}
#child {
    background-color: bisque;
    width: 180px;
    height: 100px;
}
</style>
See Also

dxhoverend

Raised when the mouse pointer leaves the element.

Module: events/hover
Type:

Event

Function parameters:
event:

Event (jQuery or EventObject)

The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery.

NOTE
This event requires the mouse pointer, and is hence supported only by desktop browsers.
See Also

dxhoverstart

Raised when the mouse pointer appears over the element.

Module: events/hover
Type:

Event

Function parameters:
event:

Event (jQuery or EventObject)

The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery.

NOTE
This event requires the mouse pointer, and is hence supported only by desktop browsers.
See Also

dxpinch

Raised when the pinch gesture has been performed.

Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
scale

Number

The ratio between the current and initial scales.

deltaScale

Number

The ratio between the current and previous scales.

cancel

Boolean

Allows you to cancel the gesture processing.

dxpinchend

Raised when the pinch gesture has been completed.

Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
scale

Number

The ratio between the current and initial scales.

deltaScale

Number

The ratio between the current and previous scales.

cancel

Boolean

Allows you to cancel the gesture processing.

dxpinchstart

Raised when the pinch gesture has been started.

Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
cancel

Boolean

Allows you to cancel the gesture processing.

dxpointercancel

Raised when the browser decides that the pointer is unlikely to produce any more events.

Module: events/pointer
Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
pointerType

String

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.

Module: events/pointer
Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
pointerType

String

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.

Module: events/pointer
Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
pointerType

String

The type of the device that raised the event: mouse, pen or touch.

dxpointerleave

Raised when a pointer is moved from either the hit test area of an element or one of its descendants.

Module: events/pointer
Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
pointerType

String

The type of the device that raised the event: mouse, pen or touch.

dxpointermove

Raised when any pointer parameter has been changed. (Position, tilt, pressure, button state, or contact geometry).

Module: events/pointer
Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
pointerType

String

The type of the device that raised the event: mouse, pen or touch.

dxpointerout

Raised when a pointer is moved from either the hit test area of an element or one of its descendants.

Module: events/pointer
Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
pointerType

String

The type of the device that raised the event: mouse, pen or touch.

dxpointerover

Raised when a pointer is moved to the hit test area of an element or one of its descendants.

Module: events/pointer
Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
pointerType

String

The type of the device that raised the event: mouse, pen or touch.

dxpointerup

Raised when the pointer loses the active buttons state.

Module: events/pointer
Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
pointerType

String

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.

Module: events/remove
Type:

Event

Function parameters:
event:

Event (jQuery or EventObject)

The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery.

dxrotate

Raised when the rotate gesture has been performed.

Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
rotation

Number

The rotation angle between the initial and current position.

deltaRotation

Number

The rotation angle between the previous and current position.

cancel

Boolean

Allows you to cancel the gesture processing.

dxrotateend

Raised when the rotate gesture has been completed.

Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
rotation

Number

The rotation angle between the initial and current position.

deltaRotation

Number

The rotation angle between the previous and current position.

cancel

Boolean

Allows you to cancel the gesture processing.

dxrotatestart

Raised when the rotate gesture has been started.

Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
cancel

Boolean

Allows you to cancel the gesture processing.

dxswipe

Raised when the swipe gesture has been performed.

Module: events/swipe
Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
offset

Number

The ratio between the swipe distance and the target element's width or height.

cancel

Boolean

Allows you to cancel the gesture processing.

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.

Module: events/swipe
Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
offset

Number

The ratio between the swipe distance and the target element's width or height.

targetOffset

Number

The ratio between the distance that should be passed to finish the motion and the target element's width or height.

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.

Module: events/swipe
Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
cancel

Boolean

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.

Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
scale

Number

The ratio between the current and initial scales.

deltaScale

Number

The ratio between the current and previous scales.

rotation

Number

The rotation angle between the initial and current position.

deltaRotation

Number

The rotation angle between the previous and current position.

translation

Object

The distance between the initial and current position.

deltaTranslation

Object

The distance between the previous and current position.

cancel

Boolean

Allows you to cancel the gesture processing.

dxtransformend

Raised when the transform gesture has been completed.

Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
scale

Number

The ratio between the current and initial scales.

deltaScale

Number

The ratio between the current and previous scales.

rotation

Number

The rotation angle between the initial and current position.

deltaRotation

Number

The rotation angle between the initial and previous position.

translation

Object

The distance between the initial and current position.

deltaTranslation

Object

The distance between the previous and current position.

cancel

Boolean

Allows you to cancel the gesture processing.

dxtransformstart

Raised when the transform gesture has been started.

Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
cancel

Boolean

Allows you to cancel the gesture processing.

dxtranslate

Raised when the translate gesture has been performed.

Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
translation

Object

The distance between the initial and current position.

deltaTranslation

Object

The distance between the previous and current position.

cancel

Boolean

Allows you to cancel the gesture processing.

dxtranslateend

Raised when the translate gesture has been completed.

Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
translation

Object

The distance between the initial and current position.

deltaTranslation

Object

The distance between the previous and current position.

cancel

Boolean

Allows you to cancel the gesture processing.

dxtranslatestart

Raised when the translate gesture has been started.

Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
cancel

Boolean

Allows you to cancel the gesture processing.

dxzoom Deprecated

Use the dxpinch event instead.

Raised when the zoom gesture has been performed.

Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
scale

Number

The ratio between the current and initial scales.

deltaScale

Number

The ratio between the current and previous scales.

cancel

Boolean

Allows you to cancel the gesture processing.

dxzoomend Deprecated

Use the dxpinchend event instead.

Raised when the zoom gesture has been completed.

Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
scale

Number

The ratio between the current and initial scales.

deltaScale

Number

The ratio between the current and previous scales.

cancel

Boolean

Allows you to cancel the gesture processing.

dxzoomstart Deprecated

Use the dxpinchstart event instead.

Raised when the zoom gesture has been started.

Type:

Event

Function parameters:
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.

Object structure:
Name Type Description
cancel

Boolean

Allows you to cancel the gesture processing.