All Apps and Add-ons

add colors to cells

sampath3033
New Member

How can we add colors to cells by using sideview utils? I don't want to add any script in application.js. I want to write all the functionality in advanced xml. How can I do this?

0 Karma

sideview
SplunkTrust
SplunkTrust

If you want to avoid writing any Javascript, Sideview Utils is the way to go.

I would start with the Sideview Utils docs around the Table module. Specifically the "custom rendering" feature. (fyi there is another similar-sounding feature in Table called "embedding" but that is more about putting custom icons and form controls into tablecells). The params that comprise the Custom "rendering" features are basically about using CSS on rows and columns and cells so as to affect the appearance of those cells - most commonly by changing background colors.

Read through that docs page and the working examples it has on it. (as with all sideview module docs, they're in the app itself -- download the app free at sideviewapps.com/apps/sideview-utils )

In a nutshell though, or if you don't have the few minutes to read the docs, if you have a field in your search results called "rowColor", whose values are one of blue,red,white,orange,yellow,etc... Then you give your Table module:

<param name="rowClass">$row.fields.rowColor$</param>

and you define the actual background-color values in CSS (see docs). Together that makes each row have the given background color. You probably also want to give the Table

<param name="hiddenFields">rowColor</param> so that it doesn't actually render a cell displaying "red" in the table.

The "rowStyle" param is very similar, except that it will write an inline CSS style right in. So if you want to compute hexcolor values in the search language with the eval function (possible but messy), you can go that way (see Sideview Utils docs for an example)

And thirdly you can add params of the form <param name="columns.fieldName.class">someClass</param> and this will paint a CSS classname of "someClass" on every cell in the "fieldName" column.

Here's an answers post that combines these ingredients into a fairly complex example, whereby some simple but very customized logic is used to determine the colors of various cells.
http://answers.splunk.com/answers/132524/custom-heatmap-logic-in-advanced-xml

While this can get complicated, the great benefit is that at no point do you have to understand or write any javascript. Remember to start from the simple working examples in the docs and build your way up.

0 Karma

martin_mueller
SplunkTrust
SplunkTrust
0 Karma

somesoni2
SplunkTrust
SplunkTrust

You want to color individual cells or complete row (I know the way to color whole row using sideview and just advanced xml, no ready to use solution individual cells)

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...