<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Custom javascript being overwritten by default Splunk default view (common.js) in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Custom-javascript-being-overwritten-by-default-Splunk-default/m-p/499541#M85140</link>
    <description>&lt;P&gt;Any inputs?&lt;/P&gt;</description>
    <pubDate>Thu, 10 Oct 2019 04:09:23 GMT</pubDate>
    <dc:creator>sirajnp</dc:creator>
    <dc:date>2019-10-10T04:09:23Z</dc:date>
    <item>
      <title>Custom javascript being overwritten by default Splunk default view (common.js)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Custom-javascript-being-overwritten-by-default-Splunk-default/m-p/499540#M85139</link>
      <description>&lt;P&gt;I'm creating a new dashboard with custom layout/style in Splunk enterprise security app. I'm experiencing an issue while adding my custom.js script to dashboard. I have placed the custom.js file in splunkenterprisesecurity/appserver/static/custom.js. When I debug the script I can view that the script being loaded successfully and the layout &amp;amp; style being applied based on the condition. However when it exit from the inner function(function (newValue)) and go back to main function (common.js), Splunk removes all the custom styles applied by inner function based on the condition. Below is the code.&lt;/P&gt;

&lt;P&gt;Any help is highly appreciated, not sure what I'm doing wrong.&lt;/P&gt;

&lt;P&gt;Please note that the id #demo is correctly defined in the html class for the panel. As I said I can see it being applied in the debug mode.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;custom.js&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;require([&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;      "splunkjs/mvc",
"splunkjs/mvc/simplexml/ready!",
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;], function (mvc) &lt;BR /&gt;
{&lt;BR /&gt;
console.log("inside");&lt;BR /&gt;
              var defaultTokenModel = mvc.Components.get("default");&lt;BR /&gt;
                        defaultTokenModel.on("change:csi", function (newValue)&lt;BR /&gt;
    {&lt;BR /&gt;
                 var csi = defaultTokenModel.get("csi");&lt;BR /&gt;
                if ((csi&amp;gt;=0) &amp;amp;&amp;amp; (csi&amp;lt;=2.5))&lt;BR /&gt;
                        {&lt;BR /&gt;
                        $('#demo').removeClass('pan_yellow');&lt;BR /&gt;
                        $('#demo').removeClass('pan_green');&lt;BR /&gt;
                       $('#demo').addClass('pan_red');&lt;BR /&gt;
                       }&lt;BR /&gt;
                else if ((csi&amp;gt;2.5) &amp;amp;&amp;amp; (csi&amp;lt;=4))&lt;BR /&gt;
                        {&lt;BR /&gt;
                        $('#demo').removeClass('pan_red');&lt;BR /&gt;
                        $('#demo').removeClass('pan_green');&lt;BR /&gt;
                        $('#demo').addClass('pan_yellow');&lt;BR /&gt;
                        }&lt;BR /&gt;
               else if ((csi&amp;gt;4) &amp;amp;&amp;amp; (csi&amp;lt;=5))&lt;BR /&gt;
                       {&lt;BR /&gt;
                        $('#demo').removeClass('pan_yellow');&lt;BR /&gt;
                        $('#demo').removeClass('pan_red');&lt;BR /&gt;
                        $('#demo').addClass('pan_green');&lt;BR /&gt;
                       }&lt;BR /&gt;
        });&lt;BR /&gt;
});&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;css file.&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;.pan_red&lt;BR /&gt;
{&lt;BR /&gt;
 background: #FE2B57 !important;&lt;BR /&gt;
}&lt;/P&gt;

&lt;P&gt;.pan_yellow&lt;BR /&gt;
{&lt;BR /&gt;
 background: #FBAA49 !important;&lt;BR /&gt;
}&lt;BR /&gt;
.pan_green&lt;BR /&gt;
{&lt;BR /&gt;
 background: #00ea77 !important;&lt;BR /&gt;
}&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:30:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Custom-javascript-being-overwritten-by-default-Splunk-default/m-p/499540#M85139</guid>
      <dc:creator>sirajnp</dc:creator>
      <dc:date>2020-09-30T02:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: Custom javascript being overwritten by default Splunk default view (common.js)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Custom-javascript-being-overwritten-by-default-Splunk-default/m-p/499541#M85140</link>
      <description>&lt;P&gt;Any inputs?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 04:09:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Custom-javascript-being-overwritten-by-default-Splunk-default/m-p/499541#M85140</guid>
      <dc:creator>sirajnp</dc:creator>
      <dc:date>2019-10-10T04:09:23Z</dc:date>
    </item>
  </channel>
</rss>

