I am using a custom type in templating in javascript grafana dashboard. Once we refresh the page no default value is selected for the custom type how to set a default value.
Here is the code
{
name: βAggregationβ,
label: βaggregationβ,
type: βcustomβ,
options: [
{
selected: false,
text: β1β,
value: β1β
},
{
selected: true,
text: β10β,
value: β10β
},
{
selected: false,
text: β30β,
value: β30β
},
{
selected: false,
text: β60β,
value: β60β
},
{
selected: false,
text: β600β,
value: β600β
},
{
selected: false,
text: β1800β,
value: β1800β
},
{
selected: false,
text: β3600β,
value: β3600β
}
],
query: β1,10,30,60,600,1800,3600β,},
Select value, which needs to be a default in the dashboard and then just save dashboard. Save dialogue will offer an option to Save current variables
:
How to save the default value of variables in dynamic dashboard using javascript
I got it working by adding this piece of code
current: { selected: true, text: data[0]['region_name'], value: data[0]['region_name'] },
Thanks a lot @jangaraj