![]() |
Custom value 1 bit - 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: Custom value 1 bit (/showthread.php?tid=2170) |
Custom value 1 bit - Domoticatorino - 25.07.2019 Hi there, I would like to customize the visu of 1 bit object (0 = Auto ; 1 = manual). But in Touch Visualisation (smartphone) I can choose visualisation in checkbox or toggle. I would like show and manage manual or auto written. What do you suggest please? Thanks. RE: Custom value 1 bit - admin - 26.07.2019 There's no direct way of doing this but it can be done with some custom JS and CSS. This example uses custom additional class and 32/1/1 group address, change in both JS and CSS as needed. JS: Code: $(function() { CSS: Code: .touch .custom .btn { RE: Custom value 1 bit - Domoticatorino - 26.07.2019 Thank you Daniel, only to be sure. The modify about JS is done in additional classes field of the icon of 32/1/1. Instead modify of CSS is done is Custom CSS of vis.graphic tab. Is it? If so it does not work. Thanks. RE: Custom value 1 bit - Daniel - 26.07.2019 JS is under Scripting ->Tools -> Custom Java Script PS Code: Admin ~=Daniel. RE: Custom value 1 bit - Domoticatorino - 26.07.2019 please find enclosed what I did. What's wrong? Thanks. RE: Custom value 1 bit - Daniel - 26.07.2019 To see any result you have to open end visualization not editor and Add additional class 'custom' to the button on visu RE: Custom value 1 bit - Domoticatorino - 26.07.2019 (26.07.2019, 14:05)Daniel. Wrote: To see any result you have to open end visualization not editor. I did it. Find enclosed the result. Thanks. RE: Custom value 1 bit - Daniel - 26.07.2019 Additional class 'custom' is missing RE: Custom value 1 bit - Domoticatorino - 26.07.2019 (26.07.2019, 14:11)Daniel. Wrote: Additional class 'custom' is missing Ok, I have to add there the same instruction I did in JS script. $(function() { if (typeof grp === 'object') { grp.listen('32/1/1', function(obj) { setTimeout(function() { $('.custom .btn').text(obj.value ? 'Manual' : 'Auto'); }, 1); }); } }); I did it without success. Thanks. RE: Custom value 1 bit - Daniel - 26.07.2019 In the Visu editor RE: Custom value 1 bit - admin - 26.07.2019 Note that this will only work in Touch visualization, not in the editor. RE: Custom value 1 bit - Domoticatorino - 26.07.2019 ooooooooooooook!! Thanks. Everything is clear now. Custom is the name given to the btn. Now I have created different name so I can link the any object I want. I thank you very much for your support. Regards. RE: Custom value 1 bit - admin - 26.07.2019 No problem, keep in mind that you need different additional class for each group addresses if you have several buttons like this. |