All Apps and Add-ons

Including JQuery/Javascript and CSS in HTML sideview utils module

watsm10
Communicator

Hi Splunkers,

I've got the latest version of Sideview Utils and am making use of the HTML module to include the results from my splunk search inside an HTML table.

What I'm trying to do is add a javascript + CSS element to it so that the colour of the a single cell changes colour depending on what value is inside the td element in the table.

I have got the javascript and CSS working correctly on jsfiddle.net, but as soon as I copy and paste into the HTML module on Splunk, the search results don't load in my dashboard and nothing else loads properly.

Has anyone got any idea of how I can get this to work?

Thanks!

sideview
SplunkTrust
SplunkTrust

You're probably better off using the rendering or even the embedding features of the Table module, rather than trying to go the other way and use the HTML module to make a table.

However, speaking just in the context of using the HTML module to generate Javascript and CSS,

a) it could possibly be a XML syntax problem - are you escaping the "html" param's contents correctly, preferably by putting it in a CDATA block? If nothing loads properly it sounds like a wrench has been thrown into a relatively low level like this.

b) are there any Javascript errors evident in Tools > Error Console, or the equivalent in your browser? If so can you add them to your question above?

c) be aware that whenever a push hits an HTML module, the HTML module re-renders it's HTML. This can have unwanted effects when the HTML module is embedding javascript, as runtime values can be unexpectedly clobbered as they get reinitialized. Sometimes a simple solution is to put the script safely upstream at a point that will never receive any "push", and keep the dynamic html parts in another HTML module further downstream.

0 Karma
Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...