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!

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 ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...