Hi, as in the Thread subjet I need to set an object's value (unsigned Integer) when a widget pops up.
Can you help me?
Thanks
Peppe
Can you help me?
Thanks
Peppe
Set a value when a widget come up
|
Hi, as in the Thread subjet I need to set an object's value (unsigned Integer) when a widget pops up.
Can you help me? Thanks Peppe
22.03.2020, 14:34
You can use this example. Set Additional classes to widget-open for the element that opens the widget. #widget-2 is widget element id, change it and group address as needed.
Keep in mind that it won't work when transition animation is enabled. Code: $(function() { There will be widget show/hide events added in RC2 firmware that will work correctly with animation: Code: $(function() {
22.03.2020, 16:40
(22.03.2020, 14:34)admin Wrote: You can use this example. Set Additional classes to widget-open for the element that opens the widget. #widget-2 is widget element id, change it and group address as needed. Ok thanks but... how I can get the actual WIDGET ELEMENT ID?
23.03.2020, 07:19
Open visualization in your browser, open the widget, right click in any empty space inside your widget and select "inspect element". In HTML inspector you will see something like <div id="widget-2"... widget-2 is your widget ID. Make sure that selector in Custom JS has # in the selector before the ID: $('#widget-2');
23.03.2020, 08:24
Ok! Everything is working... thanks!
Peppe
23.03.2020, 10:24
Just to make it perfect: How I can make a widget pop when when some grp address is triggered?
like you made for a plan with the code below: $(function(){ if (typeof objectStore !== 'undefined') { var id = Scada.encodeGroupAddress('1/1/2'); objectStore.addListener(id, function(object, type) { if (type == 'value') { showPlan(69); } }); } }); Tnx
23.03.2020, 11:50
Have you seen this?
https://forum.logicmachine.net/showthrea...34#pid1934
------------------------------
Ctrl+F5
23.03.2020, 13:14
(23.03.2020, 11:50)Daniel. Wrote: Have you seen this?yes... it seems it doesn't work
23.03.2020, 15:29
There's an easier way to show a widget by simulating a click on the element that opens it. Make sure that your sending script is not attached to the same element otherwise you will get a loop.
Here, when 1/1/1 value is true view is switched to plan 12 and if #widget-2 is not yet shown a click event is triggered on an element with class show-widget Code: $(function() {
28.04.2020, 10:44
(22.03.2020, 14:34)admin Wrote: You can use this example. Set Additional classes to widget-open for the element that opens the widget. #widget-2 is widget element id, change it and group address as needed. (22.03.2020, 16:40)gdimaria Wrote:(22.03.2020, 14:34)admin Wrote: You can use this example. Set Additional classes to widget-open for the element that opens the widget. #widget-2 is widget element id, change it and group address as needed. when I set a pincode to the button object with the class "#widget-x'" javascript doesn't work! Is there a solution? Thanks
30.04.2020, 04:42
This will not work with a pin-code. You'll have to wait for RC2 to use widget events.
|
« Next Oldest | Next Newest »
|