Dashboards & Visualizations

Clean All Filter Inputs With A Button?

vtsguerrero
Contributor

I have IN-PAGE Drill down with 6 filters, 1 dynamic drop down, 1 time picker and four text inputs...
How can I make a button which cleans all filter with the default value a "*" ??
Thanks in advance!

0 Karma
1 Solution

somesoni2
Revered Legend

You can create an html link and set the target to same view with default values for token. see this run anywhere sample.

<form>
  <label>Dynamic Source</label>
  <fieldset autoRun="true" submitButton="false">
    <input type="dropdown" token="sourcetype" searchWhenChanged="true">
      <label>Sourcetype</label>
      <choice value="*">All</choice>
      <default>*</default>
      <populatingSearch fieldForValue="sourcetype" fieldForLabel="sourcetype">
        <![CDATA[index=_internal earliest=-1h@h | stats count by sourcetype | table sourcetype ]]>
      </populatingSearch>
    </input>
    <input type="dropdown" token="source" searchWhenChanged="true">
      <label>Source</label>
      <choice value="*">All</choice>
      <default>*</default>
      <populatingSearch fieldForValue="source" fieldForLabel="source">
        <![CDATA[index=_internal earliest=-1h@h | stats count by source | table source ]]>
      </populatingSearch>
    </input>
    <html id="field10">
      <body>
      <a href="DynamicSource?form.sourcetype=*&amp;form.source=*" style="margin-left:0px">Reset</a>      
      <p /> 
      </body>
  </html>

  </fieldset>
  <row>
    <table>
      <title>Top 5 source</title>
      <searchString>index=_internal sourcetype="$sourcetype$"  source="$source$"  | timechart count</searchString>
      <earliestTime>-1h</earliestTime>
      <latestTime>now</latestTime>
      <option name="wrap">true</option>
      <option name="rowNumbers">false</option>
      <option name="dataOverlayMode">none</option>
      <option name="drilldown">cell</option>
      <option name="count">10</option>
    </table>
  </row>
</form>

View solution in original post

somesoni2
Revered Legend

You can create an html link and set the target to same view with default values for token. see this run anywhere sample.

<form>
  <label>Dynamic Source</label>
  <fieldset autoRun="true" submitButton="false">
    <input type="dropdown" token="sourcetype" searchWhenChanged="true">
      <label>Sourcetype</label>
      <choice value="*">All</choice>
      <default>*</default>
      <populatingSearch fieldForValue="sourcetype" fieldForLabel="sourcetype">
        <![CDATA[index=_internal earliest=-1h@h | stats count by sourcetype | table sourcetype ]]>
      </populatingSearch>
    </input>
    <input type="dropdown" token="source" searchWhenChanged="true">
      <label>Source</label>
      <choice value="*">All</choice>
      <default>*</default>
      <populatingSearch fieldForValue="source" fieldForLabel="source">
        <![CDATA[index=_internal earliest=-1h@h | stats count by source | table source ]]>
      </populatingSearch>
    </input>
    <html id="field10">
      <body>
      <a href="DynamicSource?form.sourcetype=*&amp;form.source=*" style="margin-left:0px">Reset</a>      
      <p /> 
      </body>
  </html>

  </fieldset>
  <row>
    <table>
      <title>Top 5 source</title>
      <searchString>index=_internal sourcetype="$sourcetype$"  source="$source$"  | timechart count</searchString>
      <earliestTime>-1h</earliestTime>
      <latestTime>now</latestTime>
      <option name="wrap">true</option>
      <option name="rowNumbers">false</option>
      <option name="dataOverlayMode">none</option>
      <option name="drilldown">cell</option>
      <option name="count">10</option>
    </table>
  </row>
</form>

simpkins1958
Contributor

When I add the HTML section to the FIELDSET it is presented on a new line instead of the row with other INPUTS . Anyway to keep HTML on same row with other INPUTs ?

0 Karma

zevg
Engager

This works for me, however is there a way of resetting without reloading the whole page?

rjthibod
Champion

Probably not without using JavaScript.

You would need to iterate through the list of tokens to find those that start with "form.", find the mvc Component for the corresponding element, get the default value, set the "form." token to the default value, and submit.

0 Karma

sreelesh_n
New Member

I was trying to do the same , but on clicking on reset , it opened up a Page -"Page not found "

0 Karma

vtsguerrero
Contributor

Or can I use a drill down link element inside an input, just a button that passes all tokens equal to * ?

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...