eventHandlers

adds event handlers to the HTML elements of a custom template of DataView items

object eventHandlers;

Example

function template() {
    return "<div class='class_name'></div>";
}
 
const dataview = new dhx.DataView("dataview", {
    template: template,
    eventHandlers: {
        onclick: {
            class_name: function(event) {
                console.log("You clicked on " + event.target.tagName);
            },
        },
        onmouseover: {
            class_name: function(event, id) {
                console.log("Item ID: " + id);
            },
        }
    }
});

Related samples

Details

The eventHandlers object includes a set of key:value pairs, where:

See also
Change log

added in v7.0

Back to top