enyo.kind({ name: "FlotView", kind: "Control", handlers: { onplotclick: "myPlotClick" }, myPlotClick: function(iS, iE) { enyo.log("myPlotClick"); return true; }, });The above code handles the event in 2.1 but not 2.2, what do I need to do, to make 2.2 catch the event?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
What kind of event is onplotclick? Something generated by another Enyo component?
http://api.jquery.com/trigger/
this never gets triggered, but the listener is registered when I look for it in the debugger.
enyo.dispatcher.listen(document, "plotclick", function() { enyo.log("enyotest"); });
this works fine, but I don't want to use jQuery for this, as I would need to re-send the event to my enyo kind using enyo.Signals or enyo.master.waterfallDown.
$(document).on("plotclick", function() { enyo.log("jquerytest"); });
How did you get it working?
Did you do a in your non-debug version?
Good news is that you can patch those events into Enyo pretty easily by adding enyo.dispatch as the listener for the custom events. http://jsbin.com/ratajosapo/1/edit?js,output
No, it doesn't display 'enyotest'.
What I meant was that 'plotclick' is added to the list of document events, but it never gets triggered.
theryanjduffy:
enyo.dispatch does work, but I still need the data in the event and I cannot find it when I use enyo.dispatch.
In your example, if you add this:
$(document).on('plotclick', function(event,pos,item) { console.log(event); console.log(pos); console.log(item); });
you will see that plotclick sends data in the 'pos' and 'item' parameters that doesn't seem to be available after enyo.dispatch.
If you replace your handlePlotClick function with this:
handlePlotClick: function (e,p,i) { this.log(e); this.log(p); this.log(i); },
You will see that the data from 'pos' and 'item' in the JQuery event is nowhere to be found.
Does enyo.dispatch ignore that data?
edit:
the 'solution' I'm currently using is this:
$(document).on("plotclick", function(event, pos, item) { enyo.master.waterfallDown("plotclick", {event: event, pos: pos, item: item}); });
not pretty.
It is basically what I already did with enyo.master.waterfallDown though.
Still, I would prefer to get rid of the jQuery event catcher.