Make Button visible/invisible - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9) +--- Thread: Make Button visible/invisible (/showthread.php?tid=702) |
Make Button visible/invisible - forsterm - 27.03.2017 Hi, i would like to make a button visible or invisible depending on KNX group address value. I think I have the following options: 1. Set the field "readonly" in the "visobjects" table true or false with lua script and then i can use the "On icon" and "Off icon" parameter from a 1 bit object 2. An additional JavaScript function ("Scripting -> Edit custom JavaScript") 3. An svg with embedded JavaScript wich of the 3 options would be the best? Are there maybe a better solution? RE: Make Button visible/invisible - Erwin van der Zwart - 27.03.2017 Hi, I would use option 2, add custom class 'hidebyknx' to your elements and try this custom JS code: Code: $(function(){ BR, Erwin RE: Make Button visible/invisible - cekca - 28.03.2017 Hi Erwin, how i can do if i want to make the object read-only by a group address...??? Thank you RE: Make Button visible/invisible - forsterm - 28.03.2017 Hi Erwin, thank you for your answer, I will use option 2. RE: Make Button visible/invisible - Erwin van der Zwart - 28.03.2017 Hi Cekca, To make it read only change .addClass("hide") and .removeClass("hide") into .addClass('item-read-only') and .removeClass('item-read-only') This sample uses the custom class 'lockbyknx' and adds a opacity of 50% to the image to indicate it's locked (: Code: $(function(){ BR, Erwin RE: Make Button visible/invisible - savaskorkmaz - 07.10.2017 Hello , I have a similiar situation. I don't want to change visibility. I just want to change read-only regarding another object value. How can i change via script ? Regards, RE: Make Button visible/invisible - Erwin van der Zwart - 07.10.2017 uHi, Exactly the same, just remove the command that change the visibility: Code: $(function(){ BR, Erwin RE: Make Button visible/invisible - batistacaceres - 05.06.2018 (27.03.2017, 19:44)Erwin van der Zwart Wrote: Hi, Hello Erwin: Sometimes when I reload the page after inactivity for 20 or 30 seconds, or after several reloads of the page, the button is showed again even when the value in object to hide is true. Is like the reload is not executing the javascript code, I have tested clearing the cache, but happening the same, even I have testing with (firefox, chrome, and explorer). Why it is happenning??? How can I fix it?? BR, Roger RE: Make Button visible/invisible - JMM - 06.06.2018 Hi, I have the same problem with several functions and not solution at the moment BR RE: Make Button visible/invisible - admin - 06.06.2018 This might happen if object element is rendered after hide is called. One possible solution is to add class to body element instead. Then the browser will handle the rest Custom CSS: Code: body.hidebyknx .hidebyknx { Custom JavaScript: Code: $(function(){ RE: Make Button visible/invisible - batistacaceres - 06.06.2018 (06.06.2018, 06:32)admin Wrote: This might happen if object element is rendered after hide is called. Thank you very much, now its working very well ... BR RE: Make Button visible/invisible - DGrandes - 08.04.2019 Hi, Is there any way to hide an image to a specific user? I use a image to show custom menu with page links but some user don't have access to these links. Links objects are hidden but the image not. Thanks RE: Make Button visible/invisible - admin - 09.04.2019 You can hide an element if there are no elements with a certain class: Code: $(function() { Add custom-menu-item class to any of your menu links and add custom-menu class to menu image. RE: Make Button visible/invisible - DGrandes - 09.04.2019 (09.04.2019, 07:46)admin Wrote: You can hide an element if there are no elements with a certain class: Thanks!! It works perfectly RE: Make Button visible/invisible - manos@dynamitec - 26.09.2019 (06.06.2018, 14:37)batistacaceres Wrote:(06.06.2018, 06:32)admin Wrote: This might happen if object element is rendered after hide is called. Hello Admin, I want to do this function but the trigger object is a 250byte string and I need multiple classes. (BTW is it possible to add more than one class on the same element? If yes what is the correct syntax?). So if the value of this object is : 1 then make visible class 'set1' and hide class 'set2,set3,...' 2 then make visible class 'set2' and hide the rest 3 ... 4 ... Thank you RE: Make Button visible/invisible - Fahd - 07.02.2023 Hi guys, I will have about 50 widgets for a thermostat where I'm displaying a 1-byte object for the fan speed, I want to hide this object when the thermostat is in heat mode. please, can I get any help? All of them in the same order Fan speed group address 6/6/x Cool/heat group address 6/7/x RE: Make Button visible/invisible - admin - 07.02.2023 Try this custom JS. Range is 6/7/1 to 6/7/50. If you need to invert the state the change var hide = !obj.value; to var hide = !!obj.value; Code: $(function(){ RE: Make Button visible/invisible - gdimaria - 24.10.2023 (06.06.2018, 06:32)admin Wrote: This might happen if object element is rendered after hide is called. I am using a function Code: $(function(){ Thanks Peppe |