Plugin Panel title doesn't reflect Template Variable automatically

Hello Grafana Community.

I created a plugin (a panel plugin) where it queries our database and display some data. I am currently experiencing some issues regarding updating the panel title.

The panel title contains a template variable (for simplicity lets call it $device). Although it does update the title, it is not “automatic”. The current scenario is happening:

Loading the dashboard will result that the selected $device shows in the panel title. However, changing the selected device it does update the content of the panel but the title does not change to accomodate the new selected device name. After selecting the panel title (i.e. accessing the dropdown menu) the title changes to the correct name.

This behaviour is particularly inconvenient as it may lead the user in error relating to the content of the panel.

I tested the same behaviour in a graph panel and the result was better, as in, does not lead in error and behaves as expected.

Would there be a way to force the update through the panel? I have searched the PanelCtrl but didnt find anything that would help me there.

Thanks in advance

Is this the behavior you’re looking for?

Screenshot 2021-09-13 at 14.28.51

Are you using a Query variable? If so, what data source are you using, and does the variable have a dependency on other variables?

Hi Marcus. Sorry for the late reply. Yes this would be the behaviour we are looking for. It works on normal panels (tried on grafana default ones and works as expected and shown in your post) but for some reason, when done through one of our developed plugins, it simply does not reflect the changes automatically. It’s a bit hard to explain.

Let’s say i change the Template Variable as shown in your earlier post. The panel title does not reflect it’s new title right away, but when entering edit mode, it shows the correct (new) title. So it feels like a refreshing problem than actually setting the title.