Dashboard 'template' and using jQuery

Does jquery need to be enabled separately when using Dashboard 'template'?

In a flow I want to use jquery calls with button elements.
This works as expected, so far so good.

However, if something is changed/edited with the flow, the browser NR page must be reloaded. Only that way the button functionality is given again.

I guess there is a setting missing!? But which one?

JQuery is enabled in template node by default.

There are examples in the help text,

<div id="{{'my_'+$id}}" style="{{'color:'+theme.base_color}}">Some text</div>
<script>
(function(scope) {
  scope.$watch('msg', function(msg) {
    if (msg) {
      // Do something when msg arrives
      $("#my_"+scope.$id).html(msg.payload);
    }
  });
})(scope);
</script>

This uses JQuery to update the html using the id of the element.
So if you add a scope.$watch you could update the document on the fly as variables change.
Also probably best to uncheck "pass through messages from input" if not required and "Add output messages to stored state"

Thanks!
From another NR example I took

<script>
(function($scope) {
 ... in here the JS code to work with the 'template'  html code 
  like \<table>  .. \</table> and all the stuff 
})(scope);
</script>

No further change was required with the imported JS.
:+1:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.