I have a custom panel plugin(“MyPanel”) that uses a custom data source, and the data source uses variables to fetch the data for the MyPanel.
The MyPanel updates variables as intended and after each variable update the MyPanel reloads and gets different data based on variables.
However, if the variable that it updates is referenced in any other panel, the variable updates(and the other panel that its referenced in) but MyPanel doesn’t reload(and because the data source uses those variables the data doesn’t change).
This happens only in case the variable is used somewhere, if its not, then MyPanel reloads properly.
Why is this happening and what would be the solution?
@igorkujacic12 If I understand correctly, your data source uses variables in the code directly, not from the Query Editor.
If it’s correct, then adding input fields, which have variables as values replaced in the code, should solve the issue. The data Source will be refreshed, and trigger panel render every time any of the mentioned variables changed.
Thank you for the response, this definitively led me to a right track. My conclusion is that if variable is not being used anywhere, updating it will trigger all panels, but as soon as its used on one panel, only that one will get triggered so I have to specify that the “MyPanel”, the one managing the variable updates actually uses those variables.
After adding an input field to panel options and writing the variable there it triggers the reload after updating the variable.
Since there are more than a few variables being used, I’ve added an addSelect option to the builder and it allows me to select one variable which again works as intended. Does the addSelect option have a multi-select option? Or do I have to create a custom option?
This is the code right now(with options being extracted variables):