Get Free Trial

Customize background color of total cell

Answered
Andrea Fabbri asked on January 11, 2022

Hello, I have to change the background color only of the signed cells in the image attached, that are the totals of the users ADE and ALE. 
How can I do it?
Thanks, 
Andrea

Attachments:
Immagine.jpg

7 answers

Public
Maksym Diachenko Maksym Diachenko Flexmonster January 12, 2022

Hello, Andrea!
Thank you for your question.
There is a way of customizing cells in Flexmonster via applying styles to classes of cells in a CSS file. You can see the list of cells’ classes via Developer Tools in your browser.
Please check the following example on JSFiddle. It contains the formatting, which is very similar to the one you mentioned on the attached image:
https://jsfiddle.net/flexmonster/e5htbqcv/
I hope this helps!
Best Regards,
Maksym

Public
Andrea Fabbri January 12, 2022

Hi Maksym, thanks for the answer.
I tried it but it not works for me beacause also some of the rows with the date are total rows. I think I can make the formatting using the level property of the cell, but I need to know wich is the max level present in the table so I can make a function that set custom class only for the cells having the max level end then apply the css rule only for that class. The problem is that I didn’t found anything that can help me to find the max level. Can you help me?
Regards,
Andrea

Public
Maksym Diachenko Maksym Diachenko Flexmonster January 13, 2022

Hello!
 
Thank you for your quick response.
Your thought is correct. Each cell of the pivot table has the level attribute, presented as fm-level-x CSS class, where x represents the level of the cell. Max-level cells are marked with fm-level-0, cells below are fm-level-1, and so on.
Please refer to this example, where formatting is specified for max-level cells:
https://jsfiddle.net/flexmonster/0cbq5w8k/
 
Please let us know if everything works fine.
 
Best Regards,
Maksym

Public
Andrea Fabbri January 13, 2022

Thanks for your response, I got the wrong term I need to know which is the lower level present in the table. 
I this case I have: level-0, level-1, level-2, level-3; but in other table I have only level-0, level-1, level-2 and I want to change the color only in the lowest level. I need a method or function that tells me in this table which is the lowest level present or how many levels are present.
Have a good day,
Andrea
 
 

Public
Maksym Diachenko Maksym Diachenko Flexmonster January 13, 2022

Hello, Andrea!
 
Hope you are doing well. The lowest level present is just a quantity of rows in your slice minus one (report.slice.rows.length - 1). Check out this example on JSFiddle, where the CSS style rule is applied to the lowest level, calculated depending on a slice. 
 
Please let us know if it works for you.
 
Regards,
Maksym
 

Public
Andrea Fabbri January 14, 2022

Hello Maksym,
thanks for your suggestions. I implemented it and it works.
Regards,
Andrea
 

Public
Maksym Diachenko Maksym Diachenko Flexmonster January 14, 2022

Hello, Andrea,
 
Thanks for your confirmation! We are glad to hear it worked.
 
Regards,
Maksym

Please login or Register to Submit Answer