Dashboards & Visualizations

In an XML dashboard, how do I hide filters on submit?

matstap
Communicator

I have an XML dashboard. I want to hide the filters when the submit button is clicked and just show the results table. What javascript do I have to write to achieve this?

0 Karma

azulgrana
Path Finder

Create a new JS file under your APP static folder with the following code

require([
         "splunkjs/mvc/simplexml/ready!"
     ], function() {
         $('#submit .btn').attr('data-action','hide-filters');
         $('#submit .btn').attr('href','#');
});

and then add the file to your XML code

<form hideChrome="True" script="hide_filters_on_submit.js">

Let me know if this works!

Cheers

niketn
Legend

@azulgrana while this will work, the Hide Filters link becomes useless. So it can also be hidden in the above JS.

$('a.hide-global-filters').attr('style','visibility:hidden');
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

azulgrana
Path Finder

Hi @niketnilay

Thanks for double checking this new approach. I think the hide-on-submit is not meant to replace the "Show/Hide Filters" and would be convenient to still keep it in case you need to review the filter criteria or make changes to it.

0 Karma

niketn
Legend

Well I meant for the dashboards using the hide_filters_on_submit.js JS file, the hide filters option becomes irrelevant because same functionality is performed by Submit button as per the question.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

Vijeta
Influencer

You can refer below link and set the tokens in your submit event-
https://answers.splunk.com/answers/615025/get-a-token-when-clicking-on-hide-filters-on-a-das.html

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...