Splunk Search

How do I Hide Table Headers?

bhenderson286
Explorer

I'm trying to hide some table headers in a dashboard. Below is my javascript code:

require(['jquery',
'splunkjs/mvc/simplexml/ready!'
], function($) {
$(document).ready(function() {
$("#table1 table thead").hide();
});
});

If I go to the console in my web browser and manually type $("#table1 table thead").hide();, the table header is hidden. I've also tried initiating a delay on the .hide function, but that didn't do anything.

Any help is greatly appreciated! Thanks.

0 Karma
1 Solution

niketn
Legend

You should be able to do this directly using CSS Selector in Simple XML CSS Extension of Splunk Dashboard. You can give you table id (or multiple pattern based matching ids). Following example uses <table id="tableWithHiddenHeader1">. Then use CSS Selector based on table id. Following is CSS snippet:

          #tableWithHiddenHeader1 thead{
            visibility: hidden;
          }

Following is the complete Run anywhere dashboard based on Splunk's _internal index:

<dashboard>
  <label>Hide Table Header Using CSS</label>
  <row>
    <panel>
      <html depends="$alwaysHideCSSStyle$">
        <style>
          #tableWithHiddenHeader1 thead{
            visibility: hidden;
          }
        </style>
      </html>
      <table id="tableWithHiddenHeader1">
        <search>
          <query>index="_internal" sourcetype="splunkd" log_level!="INFO"
|  stats count by component
|  sort - count
|  head 10</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="count">20</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">none</option>
        <option name="percentagesRow">false</option>
        <option name="rowNumbers">false</option>
        <option name="totalsRow">false</option>
        <option name="wrap">true</option>
      </table>
    </panel>
  </row>
</dashboard>

Please try out and confirm.

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

View solution in original post

niketn
Legend

You should be able to do this directly using CSS Selector in Simple XML CSS Extension of Splunk Dashboard. You can give you table id (or multiple pattern based matching ids). Following example uses <table id="tableWithHiddenHeader1">. Then use CSS Selector based on table id. Following is CSS snippet:

          #tableWithHiddenHeader1 thead{
            visibility: hidden;
          }

Following is the complete Run anywhere dashboard based on Splunk's _internal index:

<dashboard>
  <label>Hide Table Header Using CSS</label>
  <row>
    <panel>
      <html depends="$alwaysHideCSSStyle$">
        <style>
          #tableWithHiddenHeader1 thead{
            visibility: hidden;
          }
        </style>
      </html>
      <table id="tableWithHiddenHeader1">
        <search>
          <query>index="_internal" sourcetype="splunkd" log_level!="INFO"
|  stats count by component
|  sort - count
|  head 10</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="count">20</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">none</option>
        <option name="percentagesRow">false</option>
        <option name="rowNumbers">false</option>
        <option name="totalsRow">false</option>
        <option name="wrap">true</option>
      </table>
    </panel>
  </row>
</dashboard>

Please try out and confirm.

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

ejmin
Path Finder

Yes the code is working but it consume extra spaces but if you substitute it by display:none; the extra spaces will get rid but the data format will become misaligned.

0 Karma

bhenderson286
Explorer

Wow, that worked! Thank you, sir!

Here's the snippet I put in my dashboard:

  <html depends="$dontshow$">
    <style>
      #table1 thead{
      visibility:hidden;
      }
    </style>
  </html>
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Tiling

This puzzle (first published here) is based on finding groups of tessellated tiles (inspired by floor tiles I ...

SOK it to Me: Top 3 Benefits of Using Splunk Operator on Kubernetes that’ll Make ...

    Thursday, July 9, 2026  |  11:00AM–12:00PM PDT Duration: 1 hour (includes Q&A) Managing can feel like a ...

Upgrade Prep for 10.4, Network Observability Deep Dives, and More from Splunk Lantern

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...