Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Hooking up to events with Dojo

Vote:
 

I am trying to hook up an event for the media-folder using Dojo. The idea is to hook up to a hover event on images. Might be my lack of skills Dojo but i'm having trouble finding out on how to  achieve this. Any that have tried something similar or can point me in the right direction?

#117296
Feb 17, 2015 13:38
Vote:
 

I'm not really sure what you are trying to do so it is hard to give a good answer. I think perhaps the dojo/on module is what you are after; this is basically an event listener module that works with DOM nodes and classes implementing dojo/Evented. For example:

require(["dojo/on"], function(on) {
    on(document.body, "hover", function(e) {
        console.log(e);
    });
});
#117340
Feb 18, 2015 12:20
Vote:
 

Getting to understand how Dojo works, but lost on how to iterate through the items in the media-folder? Im going to assume that the items hasn't even been created in the doom in postCreate.

define([
    "dojo/dom",
    "dojo/query",
    "dojo/_base/declare",
    "dojo/on",
    "dijit/_WidgetBase",
    "epi/shell/_ContextMixin",
    "epi/shell/widget/_FocusableMixin",
], function (
    dom,
    query,
    declare,
    on,
    _WidgetBase,
    _ContentMixin
) {
    return declare("epilabs.imagepreview.init", [_WidgetBase, _ContentMixin], {
        //templateString: '',

        postCreate: function () {
            
            // Here?
            query(".dgrid-row").forEach(function (node) {

                console.log(node);
            });
        }
    });
});
#117356
Feb 18, 2015 15:21
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.