Dashboards & Visualizations

How to delete a stats table using CSS on dashboard

MeMilo09
Path Finder

Hello There, 

Been trying to get the simple task of removing a stats table using CSS. I need the data in the table, but I dont want the format of the table. I would like a white background with just my data, no rows on the table or columns. I have tried the code below, but it takes no effect on my table. Any suggestions? 

 

#removeTable . table, th, td {
        border: 0px solid black;
    }
             
        </style>

    </html>
      <table id="removeTable">

 

Labels (2)
Tags (1)
0 Karma
1 Solution

kamlesh_vaghela
SplunkTrust
SplunkTrust

@MeMilo09 

Can you please try this CSS?

 

 

       #removeTable .table th {
          background: #ffffff !important;
       }
       #removeTable .table th a{
          color: black !important;
          font-weight: bold !important;
       }
       #removeTable table tr.odd td{
        background: #ffffff !important;
      }
      #removeTable table tr.even td{
        background: #ffffff !important;
      }
      #removeTable table tr td{
        color: #000 !important;
      }

 

 

View solution in original post

kamlesh_vaghela
SplunkTrust
SplunkTrust

@MeMilo09 

Can you please try this CSS?

 

 

       #removeTable .table th {
          background: #ffffff !important;
       }
       #removeTable .table th a{
          color: black !important;
          font-weight: bold !important;
       }
       #removeTable table tr.odd td{
        background: #ffffff !important;
      }
      #removeTable table tr.even td{
        background: #ffffff !important;
      }
      #removeTable table tr td{
        color: #000 !important;
      }

 

 

MeMilo09
Path Finder

Thanks @kamlesh_vaghela  I don't see the table anymore using CSS you have provided - which is what I wanted. I appreciate all your help. 

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@MeMilo09 

If you don't wanna table but need search results then you just keep search outside table ad remove table.

Can you please try this?

<dashboard>
  <label>Only Search</label>
  <search>
    <query>| makeresults | eval data1="Hi", data2="Hello"</query>
    <done>
      <set token="tkn_data1">$result.data1$</set>
      <set token="tkn_data2">$result.data2$</set>
    </done>
  </search>
  <row>
    <panel>
      <html>
        <h1>Use below token in any search or label</h1>
        tkn_data1 : $tkn_data1$ <br />
        tkn_data2: $tkn_data2$
      </html>
    </panel>
  </row>
</dashboard>

 

I hope this will you.

 

Thanks
KV
▄︻̷̿┻̿═━一

If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.

0 Karma

MeMilo09
Path Finder

@kamlesh_vaghela  Thanks, this hides my table, but I still cant get my query to display. Where should the tokens below go? I put them in my query search after | search, but still no results. Below is also my query

$tkn_data1$
$tkn_data2$

 
My query:

<dashboard>
  <label>Only Search</label>
  <search>
    <query>| rest /servicesNS/-/-/data/lookup-table-files search="*_Report.csv"

| eval updated=strptime(updated,"%FT%T%:z")

| eval desired_time=strftime(updated, "%B %d, %Y")

| rename desired_time as "Last Updated" title as Team

| search $tkn_data1$ $tkn_data2$

| table "Last Updated", Team 

</query>
    <done>
      <set token="tkn_data1">$result.data1$</set>
      <set token="tkn_data2">$result.data2$</set>
    </done>
  </search>
  <row>
    <panel>
      <html>
        <h1>Use below token in any search or label</h1>
        tkn_data1 : $tkn_data1$ <br />
        tkn_data2: $tkn_data2$
      </html>
    </panel>
  </row>
</dashboard>
0 Karma

bowesmana
SplunkTrust
SplunkTrust

If you want the data, but no table, does not just making the panel dependant not work, i.e.

<table depends="$non_existant_token$">

when you say you 'need the data', do you mean visually or to facilitate some drilldown or other functionality in the dashboard?

 

0 Karma

MeMilo09
Path Finder

I need the data to support other functionality in the dashboard. The data is on a stats table and it’s running a | rest command that shows when look ups were last updated date wise, but since that table is occupying too much room- I have managed to reduce the table width.

At this time I just need to remove the table rows - the coloring and just have a white background, but keep the data is this possible using CSS? 

0 Karma

bowesmana
SplunkTrust
SplunkTrust

You can hide the table totally with the depends=xx syntax I describe, but the search will still run  and if you have a <done> clause as part of your table to set tokens.

How are you using that table data?

 

0 Karma

MeMilo09
Path Finder

Hi @bowesmana 

I'm not a developer and new to Splunk,  so this is tricky for me. Below is my code:

 <table depends="$non_existant_token$">
        <search>
          <query>| rest /servicesNS/-/-/data/lookup-table-files search="*_Report.csv"

| eval updated=strptime(updated,"%FT%T%:z")

| eval desired_time=strftime(updated, "%B %d, %Y")

| rename desired_time as "Last Updated" title as Team

| table "Last Updated", Team 

<done>
      <set token="tkn_data1">$result.data1$</set>
      <set token="tkn_data2">$result.data2$</set>
0 Karma

bowesmana
SplunkTrust
SplunkTrust

@MeMilo09 

OK, so the concept of <done> is that you are creating an event handler that is triggered when the search completes

the set token statements will set tokens based on the FIRST ROW of your result table, so the answer from @kamlesh_vaghela  is showing you how to get the fields from your result, but in your example you would need something like this

<table depends="$non_existant_token$">
  <search>
    <query
| rest /servicesNS/-/-/data/lookup-table-files search="*_Report.csv"
| eval updated=strptime(updated,"%FT%T%:z")
| eval desired_time=strftime(updated, "%B %d, %Y")
| rename desired_time as last_updated title as Team
| table last_updated, Team 
    </query>
  </search>
  <done>
    <set token="token_last_updated">$result.last_updated$</set>
    <set token="token_team">$result.Team$</set>
  </done>
  <any other options for the table here>
</table>

However, this is ONLY useful to get the first row of the results from your rest call. Hence my question about how you want to use the data. That's the question that needs answering.

For example, what are you intending to do with this data and if you have multiple rows, how do you want to use it?

Useful docs are

https://docs.splunk.com/Documentation/Splunk/8.1.4/Viz/PanelreferenceforSimplifiedXML

https://docs.splunk.com/Documentation/Splunk/8.2.0/Viz/tokens

https://docs.splunk.com/Documentation/Splunk/8.2.0/Viz/EventHandlerReference

 

MeMilo09
Path Finder

@bowesmana Thanks for your help, going to review the docs you sent to help me understand. 

0 Karma
Get Updates on the Splunk Community!

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...

Cultivate Your Career Growth with Fresh Splunk Training

Growth doesn’t just happen—it’s nurtured. Like tending a garden, developing your Splunk skills takes the right ...

Introducing a Smarter Way to Discover Apps on Splunkbase

We’re excited to announce the launch of a foundational enhancement to Splunkbase: App Tiering.  Because we’ve ...