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.

Diasble buttons
#1
Hi, 

Tried to use Button diasble with custom java script.

This is the script I use,

Code:
$(function(){
 
  var ObjectAddress = Scada.encodeGroupAddress('1/0/10'); // Use 1 bit object !
  objectStore.addListener(ObjectAddress, function(obj, type) {
   
     if ( obj.value == true ) {
        $(".disabledbyknx").css("opacity", 0.5);
        $(".disabledbyknx").css("pointer-events", 'none');
     } else {
        $(".disabledbyknx").css("opacity", 1);
        $(".disabledbyknx").css("pointer-events", 'all');
     }

  });
 
});

It doesnt do anything with the buttons. 

I tried in a another logic machine, and it worked there. 

Is there any solutions why it maybe doesnt work?
Reply
#2
Did you add a additional class -> disabledbyknx to all the elements on the visu that you want to disable and reloaded the visu?
Reply
#3
Yes, several times!

It works in another logic machine. 

And the diasble object its 1bit and so on.
Reply
#4
Can you try the grp.listen method? Just tried this on the latest FW and works for me..

Code:
$(function(){
  if (typeof grp != 'undefined') {
    grp.listen('1/0/10', function(object, state) {
      if (state == 'value') {
       if (object.value == true) {
        $(".disabledbyknx").css("opacity", 0.5);
        $(".disabledbyknx").css("pointer-events", 'none');
       } else {
        $(".disabledbyknx").css("opacity", 1);
        $(".disabledbyknx").css("pointer-events", 'all');
       }
      }
    }, true);
  } 
});
Reply
#5
I've tried the longpress java script also in that logic machine, it doesent work either. 

Then I've tried that script in another logic machine, and that works perfect. 
Is there maybe something with the custom javascript that isnt enabled in that logic machine that doesent work?
Can't find any differences between the logic machines...
Reply
#6
Do you see errors in the browser console (F12)? Do you run same FW version in both controllers?
Reply
#7
Is the firmware the same on both LMs?
------------------------------
Ctrl+F5
Reply
#8
Yes,

both have
"HW: LM5 Lite (i.MX6)
SW: 20240426"

I have error in the console "Uncaught SyntaxError: Unexpected end of input"

What can that means?

Just googled the error and the first answer was put another }); in the end.

Its working now,
Thanks!
Reply


Forum Jump: