I have a dashboard with many images (placed inside a ui-table, if it matters), I'm looking to add a "mouseover" listener, using a template node, so that each image will send a msg when the mouse is over it. This doesn't work unfortunately. Here's my template node code, any assistance will be greatly appreciated.
That was actually intentional, each time a message is sent to this node there are new images. So it's indeed needed to run this script every time a message is received.
Back to my original script, I've replaced the send with a simple 'alert', just to see if I'm getting anything (I'm not). In the console I'm getting printouts of 'Image 1', 'Image 2', etc., that come from the line before the addListener, so the script sees the array of images, but nothing happens after that.
Also, not sure if this is the correct way to look at it, but when I "inspect" one of the images, go to Properties, then onmouseover:null, I'm guessing that's not right.
That works! And lastly, now in the "scope.send", how would I go about sending the img.src? So I'll know what I'm hovering over, because otherwise I don't see that "event" holds any information on what the hover is on. Thank you!
Since i used a std function instead of arrow function, this should be the object that was mouseovered. In theory, you can then access any property of the img element using $(this).prop("_prop_name_") or any data value you added to the img using $(this).data("_data_item_name_") and build whatever payload you desire.