Splunk Search

How to enable / disable table element drilldown through java script

rakesh_498115
Motivator

Hi All,

I was having a requirement to enable / disable table element drilldown. i mean if my SH is a Job server i would enable the drilldown option for table elment and should disable the option if its a Search head.

I have used the following code snippnet . but this not working . Can you please help me ? where am i going wrong ??

// Sample code

     var element1 = new TableElement({
             "id": "element1",          
         `"link.exportResults.visible":  "true",
            "link.inspectSearch.visible": "false",
             "link.openSearch.visible": "false",            
               "drilldown": "row",
            "rowNumbers": "true",
            "managerid": "search1",
             "el": $('#element1')
         }, {tokens: true}).render();


            if(host ="JobServer")       {
             element1.settings.set("drilldown","row");
            }
            if(host ="SearchHead")      {
             element1.settings.set("drilldown","none");
            }

Please help me !! Thanks in Advance 🙂

Tags (2)
0 Karma

piUek
Path Finder

The problem is in the host = 'JobServer' . In javascript '=' is the assignment operator. To compare You should use identity operator: '==='.
Please check http://www.c-point.com/javascript_tutorial/jsgrpComparison.htm for reference.

So your code should be:

 if (host === "JobServer") {
    element1.settings.set("drilldown", "row");
 }
 if (host === "SearchHead") {
    element1.settings.set("drilldown", "none");
 }
0 Karma

paramagurukarth
Builder

Can you please share your xml :)..

0 Karma

sfatnass
Contributor

hi rakesh did you solved your problem?

0 Karma
Get Updates on the Splunk Community!

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...