Developing for Splunk Enterprise

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

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

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

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