Dashboards & Visualizations

How to enable or disable dashboard panels based on a drop-down value?

rahul_jasrotia
Path Finder

Hi,

I want to enable or disable a dashboard panel based on a drop-down value. For example, there are 2 values in drop-down and 2 panels say-
Drilldown has 2 values - A and B
Panels- 1 and 2
If A is selected 2 panel is hidden and 1 is displayed
If B is selected, 1 is hidden 2 is displayed.
Any pointers would be helpful on the same.

0 Karma
1 Solution

tom_frotscher
Builder

Hi,

you can take a look at the depends and rejects tags of the panel: Link

You should be able to set an token based on your dropdown and with the depends and reject tokens your decide if a panel is shown or not. There is a realy good example in the "Splunk 6.2 Overview" app called "Universal Hide-Show Objects".

Greetings

Tom

View solution in original post

tom_frotscher
Builder

Hi,

you can take a look at the depends and rejects tags of the panel: Link

You should be able to set an token based on your dropdown and with the depends and reject tokens your decide if a panel is shown or not. There is a realy good example in the "Splunk 6.2 Overview" app called "Universal Hide-Show Objects".

Greetings

Tom

Harishma
Communicator

Hi Rahul,

Even I have a similar requirement wherein , the respective dashboard should display depending on the dropdown selection.
Can you please let me know how you got this done?
Can you please provide the source code?
Thanks in advance for the help.

0 Karma

rahul_jasrotia
Path Finder

Harishma,
With the new version of splunk, you can use the tag in the dashboard and can basically assign the dropdown value to a token and can use the same in the depends on tag.

For previous versions, i had changed my dashboard to a html dashboard and then caught the drilldown event and used if else to compare its values and enable/disable the panels.

Refer to the below link:-
https://answers.splunk.com/answers/188709/how-to-display-dashboard-panels-dynamically.html
Hope that solves your issue.

0 Karma

rahul_jasrotia
Path Finder

Hi Tom,

Thanks you very much but i'm afraid i forgot to include here that i'm using Splunk 6.1. Heard someone telling me to make use of JS and MVC , not sure how to do that as i'm relatively new here.

0 Karma

tom_frotscher
Builder

Yeah this might also be a solution. Sorry i can not provide a complete solution for this way. But basically, you have to call a js file within your view (Doku). Within the js you can check the value of your dropdown and with this information you can hide/show the panels. This can happen for example via css display: none or something similar. However, you need some experience with js and the splunk webframework to get such an solution up and running. ou can check out splunk dev for some tutorials on this topic.

Greetings

Tom

0 Karma

rahul_jasrotia
Path Finder

Thanks Tom, i finally found a way of doing the same. Just caught the drilldown event and used if else to compare its values and enable/disable the panels. Thanks for your help .

rahul_jasrotia
Path Finder

Guys any pointers would be welcome.

0 Karma
Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...