Building for the Splunk Platform

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 on Splunk Lantern in August

This month’s Splunk Lantern update gives you the low-down on all of the articles we’ve published over the past ...

Welcome to the Future of Data Search & Exploration

You have more data coming at you than ever before. Over the next five years, the total amount of digital data ...

This Week's Community Digest - Splunk Community Happenings [8.3.22]

Get the latest news and updates from the Splunk Community here! News From Splunk Answers ✍️ Splunk Answers is ...