Splunk Search

How to remove table headers from tableView Object in Javascript?

splunkrocks2014
Communicator

I wanted to remove the table headers from a statistics table. I tried to add it the following code to my javascript, but it doesn't work.

document.getElementById("myTable").deleteTHead();

Can we use tableView object to remove the table headers? If not, what is the best practice? Thanks.

0 Karma

arkadyz1
Builder

Assuming you have <table id="myTable"> in your simple XML somewhere, I don't think "myTable" is an HTML table's ID. I'd go through mvc.Components.get and then use getVisualization on the result - like that:

mvc.Components.get('myTable').getVisualization(function(tableView){
          tableView.table.deleteTHead();
}
0 Karma

splunkrocks2014
Communicator

It doesn't work. According to the following document, the tableView doesn't have table in the properties

http://docs.splunk.com/DocumentationStatic/WebFramework/1.2/compref_table.html

0 Karma

arkadyz1
Builder

Have you actually tried that? The tableView inside that function is the result of getVisualization, not the component brought back by mvc.Components.get.

Also, with Splunk, one cannot rely on documentation alone - many things are underdocumented, or the useful definitions are spread across multiple documents.

Take a look at the answer in this question, for example.

0 Karma
Get Updates on the Splunk Community!

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...