Logic Machine Forum
Dynamic Navigation - 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: Dynamic Navigation (/showthread.php?tid=4727)



Dynamic Navigation - Morten L - 21.04.2023

Im trying to make a clickable link change its destination based on an alarm.

I've tried multiple things like changing the link and refreshing the site.
I've dug down into the code, but i cant replicate the way it behaves.

I see its loading in all the visualization pages and hiding and unhiding them, but when i try to replicate this the image gets distorted.

Any suggestions from those with deeper understanding of the code?


RE: Dynamic Navigation - admin - 21.04.2023

Add this to custom JavaScript. Link element additional class must be set to alarm-link. When 1/1/1 is true plan ID 1 is shown, 2 otherwise.
Code:
$(function() {
  $('.alarm-link').off('vclick').on('vclick', function() {
    var alarm = grp.getvalue('1/1/1'), id;
    
    if (alarm) {
      id = 1;
    }
    else {
      id = 2;
    }
    
    showPlan(id);
  });
});



RE: Dynamic Navigation - Morten L - 24.04.2023

This is perfect, thank you very much