Splunk Dev

SplunkJS: How to hide a column in a TableView but still have the hidden field values available in drilldown tokens.

sideview
SplunkTrust
SplunkTrust

I have several fields that are ID fields, for which both the names and the values are quite long. I need these id fields to all be present because they are crucial for table drilldown interaction, but I want to keep them from rendering in the table, taking up space and distracting the user.

Looking in the docs, examples, tutorials, example apps etc, I haven't been able to find anything that talked about this.

Tags (2)
1 Solution

sideview
SplunkTrust
SplunkTrust

In the end the answer ended up being right in the most obvious place - you specify the fields you want to be visible in "fields" param on TableView. When I had first read this property I assumed that not specifying a field in this param meant those values wouldn't be present in the drilldown context. However that's not the case.

I do wish there was a second optional property, "hiddenFields", mutually exclusive with "fields", so I could have it render all fields EXCEPT certain fields I tell it about, but that's me wishing for things.

Along the way I had many happy adventures trying to do this using very complex mechanisms. I tried my hand at writing a custom CellRenderer class, and when that was more trouble than it was worth I was able to hook into the underlying bootstrap "rendered" event to go hide the relevant columns and cells on every render, basically with:

table.listenTo(table.table, 'rendered', function(){ console.log("evil things go here"); }, table);

But compared to the fields property, those were pretty bad ideas!! I mention them only so that other similarly lost souls are able to find this page in the future.

View solution in original post

sideview
SplunkTrust
SplunkTrust

In the end the answer ended up being right in the most obvious place - you specify the fields you want to be visible in "fields" param on TableView. When I had first read this property I assumed that not specifying a field in this param meant those values wouldn't be present in the drilldown context. However that's not the case.

I do wish there was a second optional property, "hiddenFields", mutually exclusive with "fields", so I could have it render all fields EXCEPT certain fields I tell it about, but that's me wishing for things.

Along the way I had many happy adventures trying to do this using very complex mechanisms. I tried my hand at writing a custom CellRenderer class, and when that was more trouble than it was worth I was able to hook into the underlying bootstrap "rendered" event to go hide the relevant columns and cells on every render, basically with:

table.listenTo(table.table, 'rendered', function(){ console.log("evil things go here"); }, table);

But compared to the fields property, those were pretty bad ideas!! I mention them only so that other similarly lost souls are able to find this page in the future.

Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...