How to listen for when a variable changes?

Hello, has there been any update with this? I am working on a project with a grafana timestream panel, and a custom built panel. From my custom panel, I am able to easily update grafana variables, and my timestream panel updates as expected. The timestream panel also updates variables based on user interaction, however I cannot monitor changes to these variables from my custom panel (wanting bi-directional rather than uni-directional communication). I can only see what the variable is sent to on page refresh in my custom panel.

@simones you mentioned that you were able to fix this by putting replaceVariables() inside of onChange() functions. Could you supply some sample code? I don’t understand how you were able to get this to work.

Thanks in advance

@rickyjohnson did you try my code here? How to listen for when a variable changes? - #17 by ollieboyd

Hi @ollieboyd I did not try your implementation based on @cfife 's experiment with it. Variable changes from Grafana do cause the url string to update, so in code I am looking for any changes to the url string and based on that, I can see what variable has changed and execute the appropriate code which works pretty well. But I was just curious if there is a more straightforward way to do this by now, but it seems like it is still a Grafana issue.

This topic was automatically closed after 365 days. New replies are no longer allowed.