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
Revered Legend

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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

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

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...