Dashboards & Visualizations

Is it possible to style a link in a drilldown in an XML dashboard?

mistydennis
Communicator

Is it possible to style a link in a drilldown in an XML dashboard? I have a dashboard with links to another system. I would like for the link to change color (or something similar) after a user clicks on it so the user knows they have already visited this link.

Is this possible in an XML dashboard?

Here's my code for the drilldown:

<option name="drilldown">row</option>
<drilldown>
<link target="_blank">$row.FolderLink|n$</link>
</drilldown>
0 Karma

niketn
Legend

@mistydennis try the following run anywhere example which has a drilldown to link created. It uses jQuery to add clicked class to each clicked cell. Then CSS override is used to apply background color for such clicked cells.

<dashboard script="table_clicked_cell.js">
  <label>Table Drilldown</label>
  <row>
    <panel>
      <html>
        <style>
          #tableWithDrilldownColor tbody tr td.clicked{
            background: #99C5D7;
          }
        </style>
      </html>
      <table id="tableWithDrilldownColor">
        <search>
          <query>index=_internal sourcetype=splunkd log_level=* component=*
| chart count by component log_level limit=5 useother=f
| head 10</query>
          <earliest>-1h@h</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="count">20</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">cell</option>
        <option name="percentagesRow">false</option>
        <option name="rowNumbers">false</option>
        <option name="totalsRow">false</option>
        <option name="wrap">true</option>
        <drilldown>
          <link target="_blank">https://google.com</link>
        </drilldown>
      </table>
    </panel>
  </row>
</dashboard>

Following is the required JS file table_clicked_cell.js

 require([
     'underscore',
     'jquery',
     'splunkjs/mvc',
     'splunkjs/mvc/tableview',
     'splunkjs/mvc/simplexml/ready!'
 ], function (_, $, mvc, TableView) {
     console.log("Script Started");
     $(document).on("click","#tableWithDrilldownColor table tbody tr td",function(){
         $(this).removeClass("clicked").addClass("clicked");
     });
 });

Please try out and confirm!

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
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!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

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