Logic Machine Forum
Get group address when hover an element via Javascript - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Get group address when hover an element via Javascript (/showthread.php?tid=2347)



Get group address when hover an element via Javascript - Mirco - 14.11.2019

Hi, I would like to know if someone know to get the related group address and group name of a visu element when I hover it.

I need to change a text via javascript, when i hover an element.

Thanks
Mirco


RE: Get group address when hover an element via Javascript - admin - 14.11.2019

Like this:
Code:
var addr = $(el).data('object');
var id = Scada.encodeGroupAddress(addr);
var obj = objectStore.getObject(id);



RE: Get group address when hover an element via Javascript - Mirco - 14.11.2019

It doesn't work like I want Sad 

Code:
$(".tooltip").mouseover(function(){
    var addr = $(".tooltip").data('object');
    var id = Scada.encodeGroupAddress(addr);
    var obj = objectStore.getObject(id);
});

this is my code, but if I have more visu element with Class "tooltip", this code give me the first group name of the first element that I hover

Someone can help me?


RE: Get group address when hover an element via Javascript - Mirco - 18.11.2019

No one that can help me? Please I need it!


RE: Get group address when hover an element via Javascript - admin - 18.11.2019

Replace second ".tooltip" with this


RE: Get group address when hover an element via Javascript - Mirco - 19.11.2019

Thank you! It works perfectly! Big Grin


RE: Get group address when hover an element via Javascript - Thomas - 27.11.2019

This is great feature! Would it be possible to limit the tooltip to Admin account and usermode only?


RE: Get group address when hover an element via Javascript - admin - 27.11.2019

For usermode only change selector to ".usermode .tooltip", as for admin-only see this example by Erwin: https://forum.logicmachine.net/showthread.php?tid=1145