This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Add button(s) to visualisation using javascript
#5
I've used CSS to add labels in the past, however in this instance there are a lot of buttons (one for each light in the building / 50 or so per floor) so it would be preferable to dynamically add this based on the Custom Name applied to the object on this Widget. 

Can't this be achieved by pulling this info from the data object on the page?  I'm just not quite sure how to access the info from the object as yet.


I'm using the following javascript to dynamically hide buttons based on their value

Code:
$(function() {
  $('.hidden-by-value').each(function(_, el) {
    var addr = $(el).data('status-object');
    if (addr) {
      grp.listen(addr, function(obj) {
        var value = obj.value;
        $(el).css('visibility', value ? 'visible' : 'hidden');
      });
    }
  });
});


Many thanks


Kind Regards
James
Reply


Messages In This Thread
RE: Add button(s) to visualisation using javascript - by jamesng - 10.10.2022, 11:19

Forum Jump: