All Apps and Add-ons

Including JQuery/Javascript and CSS in HTML sideview utils module


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, 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?



Re: Including JQuery/Javascript and CSS in HTML sideview utils module


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