Dashboards & Visualizations

How can I hide/Unhide a dashboard panel based on the checkbox choosen?

pavanae
Builder

I am able to add the checkbox as shown below:-

alt text

As show above I just want the Panel_1 displayed only when I choose the checkbox Show under Overview.

Where as XML code is as follows

--------
-------
 <input type="checkbox" token="overview" searchWhenChanged="true">
             <label>Overview</label>
             <choice value="true">Show</choice>
             <change>
               <condition label="Show">
                 <set token="overview">true</set>
               </condition>
             </change>
             <default>true</default>
           </input>

  </fieldset>
  <row>
    <panel depends="$overview$">
      <title>Panel_1</title>
      <table>
        <search>
------
-----

The above xml is not working as the Panel_1 is displaying anyway irrespective of the option I choose in the checkbox.

Any help would be great.

0 Karma
1 Solution

jpolvino
Builder

Please try this simple example dashboard (just paste source) as a starting point:

<form>
  <label>pavanae</label>
  <fieldset submitButton="false"></fieldset>
  <row>
    <panel>
      <title>panel title</title>
      <input type="checkbox" token="repeatHelp" searchWhenChanged="true">
        <label></label>
        <choice value="TRUE">Display help for this section</choice>
      </input>
    </panel>
  </row>
  <row>
    <panel depends="$repeatHelp$">
      <html>
    <p>
      <b>Help:</b> This section is used to identify...
    </p>
    </html>
    </panel>
  </row>
</form>

The depends can be applied to a row or panel.

View solution in original post

0 Karma

jpolvino
Builder

Please try this simple example dashboard (just paste source) as a starting point:

<form>
  <label>pavanae</label>
  <fieldset submitButton="false"></fieldset>
  <row>
    <panel>
      <title>panel title</title>
      <input type="checkbox" token="repeatHelp" searchWhenChanged="true">
        <label></label>
        <choice value="TRUE">Display help for this section</choice>
      </input>
    </panel>
  </row>
  <row>
    <panel depends="$repeatHelp$">
      <html>
    <p>
      <b>Help:</b> This section is used to identify...
    </p>
    </html>
    </panel>
  </row>
</form>

The depends can be applied to a row or panel.

0 Karma

jpolvino
Builder

Kind of like the @richgalloway solution, I do this:

  <fieldset submitButton="false" autoRun="false">
    <input type="checkbox" token="showDetails" searchWhenChanged="true">
      <label></label>
      <choice value="TRUE">Display Details</choice>
    </input>
  </fieldset>
  <row>
    <panel depends="$showDetails$">
...

Slightly different look and feel. I use this a lot for hiding/showing a help panel to assist using the dashboard.

0 Karma

pavanae
Builder

Thank you @jpolvino . Still no luck. Does it due to limition on my browser I'm on chrome and my splunk version is 6.6.6.1

0 Karma

jpolvino
Builder

Could not paste XML here, so please see my other answer

0 Karma

richgalloway
SplunkTrust
SplunkTrust

This works in one of my dashboards.

...
<input type="checkbox" token="foo">
  <label>Overview</label>
  <choice value="true">Show</choice>
  <delimiter> </delimiter>
</input>
</fieldset>
...
<row>
<panel depends="$foo$">
  <title>Panel 1</title>
  <table>
...
---
If this reply helps you, Karma would be appreciated.
0 Karma

pavanae
Builder

Thanks for the response @richgalloway. For some reason It didn't worked on mine.

0 Karma

jpolvino
Builder

Try adding searchWhenChanged="true" right after token="foo"

0 Karma
Get Updates on the Splunk Community!

This Week's Community Digest - Splunk Community Happenings [9.26.22]

Get the latest news and updates from the Splunk Community here! Upcoming User Group Events! &#x1f44f; Check ...

BSides Splunk 2022 - The Call for Papers is now Open!

TLDR; Main Site: https://bsidessplunk.com CFP Site: https://bsidessplunk.com/cfp CFP Opens: December 15th, ...

Sending Metrics to Splunk Enterprise With the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. The OpenTelemetry project is the second largest ...