All Apps and Add-ons

How do I remove 'show details' link from Sideview Table results?

IngloriousSplun
Communicator

Whenever a search does not return results, the Table module displays "No results found. Show details". Is there an easy way to remove the "Show details" link to just display "No results found"?

1 Solution

sideview
SplunkTrust
SplunkTrust

Not very easily, no. It's a good request and I'll look into adding a param or making it otherwise configurable somehow.

Here's the "not very easy" way. (I just wrote this up for you in case you're wondering where it came from).

1) put this into your Table module.

<param name="customBehavior">noShowDetailsLink</param>

2) Put this block of JS into application.js, in the app in question. If you had to create an application.js to do so, don' t forget to restart splunk web after application.js file exists on disk.

if (typeof(Sideview)!="undefined") {
    Sideview.utils.declareCustomBehavior("noShowDetailsLink", function(tableModule) {
        tableModule.displayNoResultsMessage = function() {
            this.resultsContainer.html("");
            var message = $("<p>")
              .addClass("status")
              .addClass("emptyResults")
              .append(_('No results found. '));
            this.resultsContainer.append(message);
        }
    });
}

This basically clobbers the base implementation of displayNoResultsMessage, and replaces it with a simpler one that just displays "no results found".

View solution in original post

sideview
SplunkTrust
SplunkTrust

Not very easily, no. It's a good request and I'll look into adding a param or making it otherwise configurable somehow.

Here's the "not very easy" way. (I just wrote this up for you in case you're wondering where it came from).

1) put this into your Table module.

<param name="customBehavior">noShowDetailsLink</param>

2) Put this block of JS into application.js, in the app in question. If you had to create an application.js to do so, don' t forget to restart splunk web after application.js file exists on disk.

if (typeof(Sideview)!="undefined") {
    Sideview.utils.declareCustomBehavior("noShowDetailsLink", function(tableModule) {
        tableModule.displayNoResultsMessage = function() {
            this.resultsContainer.html("");
            var message = $("<p>")
              .addClass("status")
              .addClass("emptyResults")
              .append(_('No results found. '));
            this.resultsContainer.append(message);
        }
    });
}

This basically clobbers the base implementation of displayNoResultsMessage, and replaces it with a simpler one that just displays "no results found".

IngloriousSplun
Communicator

Thank you. To confirm my understanding, when you say:

1) put this into your Table module.

<param name="customBehavior">noShowDetailsLink</param<

What you're referring to is adding a customBehavior param named noShowDetailsLink under the Table module, correct? Based on your JS that seems to be the case.

0 Karma

sideview
SplunkTrust
SplunkTrust

No, I failed to check silly markdown syntax before I posted. I will fix. I meant

<param name="customBehavior">noShowDetailsLink</param>

and of course without backticks it ate my param tag. (multiple edits fighting with the site to make it stop mangling code in backticks)

0 Karma

IngloriousSplun
Communicator

I see your edit above now, that's exactly what I was thinking of doing. For some reason it keeps eating the tags for me too, which is why I had to ask it the way I did. I'll try it tomorrow, thanks.

0 Karma

IngloriousSplun
Communicator

It looks like adding that to application.js is having some unexpected behavior and I don't know enough about Sideview to really diagnose it. I added the above to the JS file and restarted the web service, and when I reload the page my tables are broken. Results are no longer displaying, I have a single checkbox (I'm using the Checkbox module for acknowledgements) displayed on the left of the table, and in the Table header area it displays my ValueSetter group name. This is a sample for one of my tables, I unfortunately can't post a screenshot because its on an isolated system.

EDIT: Keeps eating my tags.

...

<param name="html"><!CDATA[<h2>TITLE</h2>]]></param>


<param name="search">mySearchMacro</param>
<module name="Pager">
  <module name="Table">
    <module name="CustomBehavior">
      <param name="customBehavior">noShowDetailsLink</param>
    </module>
    <module name="HTML" group="row.fields.Event Link">
      <param name="html"><![CDATA[<a href="$row.fields.Event Link$">View Details</a>]]> </param>
    </module>

    <module name="ValueSetter" group="row.fields.Acknowledge">
      <param name="name">state</param>
      <param name="value">$row.fields.state$</param>

      <module name="Checkbox">
        <param name="name">state</param>
        <param name="onValue">Y</param>
        <param name="offValue"></param>

         <module name="Search">
           <module name="search">| inputlookup myLookup | append [stats count | fields - count | eval myIdField="$row.fields.myIdField$" | eval state="$state$" ] | stats last(state) as state by myIdField | outputlookup myLookup</module>
              <module name="CustomBehavior">
                <param name="requiresDispatch">True</param>
             </module>

Based on the above, what happens is the Table displays row.fields.Event Link and row.fields.Acknowledge, followed by the table TITLE, followed by a single checkbox aligned left. Thoughts?

0 Karma

sideview
SplunkTrust
SplunkTrust

The problem was simply that I had a misplaced curly brace in the JS, so you were getting an exception in application.js which derailed the page load. Nothing in your view affects whether this customBehavior will work, it was just a typo.

0 Karma

IngloriousSplun
Communicator

That doesn't result in the "Show details" link being removed.

Just to confirm, this is the correct implementation of it in the XML under the Table module:

 <module name="CustomBehavior">
   <param name="customBehavior">noShowDetailsLink</param>
 </module>
0 Karma

sideview
SplunkTrust
SplunkTrust

No. The customBehavior param goes in the Table module. Dammit it ate my tags again! I'll fix again. I meant put the customBehavior param literally in the Table module.

<module name="Table">
  <param name="customBehavior">noShowDetailsLink</param>
0 Karma

IngloriousSplun
Communicator

Under the Table module or in? I have it under that module designator like I show in my big code sample above.

Edit: It keeps eating my tags too, its ridiculous.

Edit 2: That works, I had it under the CustomBehavior module as well.

Thanks.

0 Karma
Get Updates on the Splunk Community!

How to Monitor Google Kubernetes Engine (GKE)

We’ve looked at how to integrate Kubernetes environments with Splunk Observability Cloud, but what about ...

Index This | How can you make 45 using only 4?

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

Splunk Education Goes to Washington | Splunk GovSummit 2024

If you’re in the Washington, D.C. area, this is your opportunity to take your career and Splunk skills to the ...