Color crosstab report lines

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
marisoft
User
Posts: 209

Color crosstab report lines

Post by marisoft »

In a crosstab report I am color coding the values in the cross tab with code in Cell_rendered event like this:

 if ($this->RowType == ROWTYPE_DETAIL) {
		 if ($percent > 89){
		   $CellAttrs["style"] = "background-color: red; color: white; text-align: right;";
		 }
}

But I would like to NOT color the lines total amount.
How do I avoid this?

Tia
/Poul


arbei
User
Posts: 9286

Post by arbei »

You may check the total lines by, e.g.

if ($this->RowTotalType == ROWTOTAL_GROUP) { ... } // Group total
if ($this->RowTotalType == ROWTOTAL_PAGE) { ... } // Page Total
if ($this->RowTotalType == ROWTOTAL_GRAND) { ... } // Grand total

marisoft
User
Posts: 209

Post by marisoft »

Thanks, but it is not total lines, but the last cell in the detail line containing the total that I do not want to color.

In dev-tools I see this:

<td class="ew-table-row ew-table-last-col" style="background-color: lightgreen; text-align: right;">
   <ul class="list-unstyled ew-crosstab-values">
   <li><span>199</span></li>
   <li><span>6</span></li> 
   <li><span>33</span></li>
   </ul>
</td>

so I need to detect within RowType == ROWTYPE_DETAIL that it is last column.


arbei
User
Posts: 9286

Post by arbei »

marisoft wrote:

<td class="ew-table-row ew-table-last-col" ...

So you may try to check if you can find this CSS class in the $CellAttrs argument of the event, you can var_dump($CellAttrs) to see the contents first.


marisoft
User
Posts: 209

Post by marisoft »

For a detail line with 7 numbers, last on being the total I am getting this with var_dump($CellAttrs):

array(1) { ["class"]=> string(0) "" } string(3) array(1) { ["class"]=> string(0) "" } string(3) array(1) { ["class"]=> string(0) "" } string(3) array(1) { ["class"]=> string(0) "" } string(3) array(1) { ["class"]=> string(0) "" } string(3)
array(1) { ["class"]=> string(0) "" } string(3) array(1) { ["class"]=> string(0) "" }

Not shure what to make of that.

/Poul


arbei
User
Posts: 9286

Post by arbei »

So the CSS class is not added by server side code, then you may simply add your CSS under HTML -> Styles -> User tab to override the color, e.g.

.ew-table-last-col {
    background-color: white; 
}

marisoft
User
Posts: 209

Post by marisoft »

Fantastic.

That did it :-)


marisoft
User
Posts: 209

Post by marisoft »

Sorry I was a bit to fast to conclude her - tested with wrong values.

Even though I have the user CSS style for .ew-table-last-col set as suggested, it seem that my code in Cell_rendered event overrides it.

So this color is stil being applied:
if ($this->RowType == ROWTYPE_DETAIL) {
if ($percent > 89){
$CellAttrs["style"] = "background-color: red; color: white; text-align: right;";
}
}


Post Reply