Skip to main content
Announcements
Jan 15, Trends 2025! Get expert guidance to thrive post-AI with After AI: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Zeta
Contributor III
Contributor III

Table rows in two colors alternating

Dear Community,

Is there a way to display table rows in two colors, similar to the attached Excel version? (The color is unimportant)

I would be very grateful for any help.

Best regards

Labels (1)
1 Solution

Accepted Solutions
MatheusC
Specialist II
Specialist II

Hi,  

You can do this by expressing the background color of each column with rowno() and mod(), as mentioned by @RégisBer  this will color your rows

if(mod(rowno(total),2)=0,'YourColor')

This will give you the result, but it may not be what, it will interfere with your dynamic sorting on your table columns

Another example would be the use of CSS, in the Multi KPI chart of custom objects, style tab

[data-tid="qv-st-row"]:nth-child(odd) {
background-color: #EAEAEA;
}

The point for this use is that it will not interfere with your dynamic classification, but if there are other tables also in this application, it will receive this customization.


- Regards, Matheus

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!

View solution in original post

7 Replies
RégisBer
Partner - Contributor II
Partner - Contributor II

Hello, use this formulas in dimension and expression cell background-color

if(mod(RowNo(),2)=0,RGB(192,230,245),white())

 

Regards,

 

MatheusC
Specialist II
Specialist II

Hi,  

You can do this by expressing the background color of each column with rowno() and mod(), as mentioned by @RégisBer  this will color your rows

if(mod(rowno(total),2)=0,'YourColor')

This will give you the result, but it may not be what, it will interfere with your dynamic sorting on your table columns

Another example would be the use of CSS, in the Multi KPI chart of custom objects, style tab

[data-tid="qv-st-row"]:nth-child(odd) {
background-color: #EAEAEA;
}

The point for this use is that it will not interfere with your dynamic classification, but if there are other tables also in this application, it will receive this customization.


- Regards, Matheus

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!
Zeta
Contributor III
Contributor III
Author

Thank you for the solution, but if I use this formula in Data -> Columns -> "Background color expression" the table can no longer be sorted by a measure column. Therefore, unfortunately, I cannot apply this solution.

How could I solve the problem?

Best regards

Escudeiro
Contributor
Contributor

The alternative seems to have already been informed above by @MatheusC 

Zeta
Contributor III
Contributor III
Author

Thank you for the details on the sorting function. This should work in my case too. Unfortunately, the way the multi KPI is displayed is visually very unattractive. Is there no solution in the table chart?

MatheusC
Specialist II
Specialist II

The graphical solution would be the one presented with rowno(), Using Rowno() causes the sorting to be lost, hence the use of CSS.

In the case of Mult KPI, regarding visualization, you could try customizing the Backgroud color of the KPI graph itself and scaling the size in a way that makes it presentable.

However, these are currently the suggestions presented.

- Regards, Matheus

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!
chriscammers
Partner - Specialist
Partner - Specialist

I did a quick test and I created a theme with no properties in it besides an entry in css. I believe this will use the default theme for all the other colors and properties.

The line I added in the css sets the alternate row colors. there are other properties you can set too but you'll have to inspect the objects in your browser dev tools to figure out the properties you want to manipulate.

This is the css code

 

tr.qv-st-data-row.ng-scope {
    background-color: #00d3ff1c;
}

 

I will admit I'm not exactly sure how this alternates rows since there is no conditional evaluation  but I imagine if I inspected the page a bit more closely I'd figure it out.

I hope this helps.

 

Chris