Text Colour in list View based on logic

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

Text Colour in list View based on logic

Post by johnberman »

Hi

I have a list view that amongst other things has two fields from a table
Durationc
Durations

In the list view if possible I would like to apply some logic like so

If Durationc has no value then display the value of Durations in the nowmal way
If Durationc has a value then display the value of Durations but make the text red

hope this makes sense

Regards
John B


mobhar
User
Posts: 11703

Post by mobhar »

You may simply use "Row_Rendered" server event. Please read "Server Events and Client Scripts" topic from PHPMaker Help menu for more info and examples.


rodrigofaustino2
User
Posts: 28

Post by rodrigofaustino2 »

function Row_Rendered() {
if ($this->Durationc->ViewValue == "") {// List page only
$this->RowAttrs["style"] = "background-color: orange";

	  }else{
		 
		$this->RowAttrs["style"] = "background-color: red";
		
		}

}


johnberman
User
Posts: 210

Post by johnberman »

Sorry

Can this be updated so if field durationc has any value at all then field duration has a red background

John B


mobhar
User
Posts: 11703

Post by mobhar »

Simply change:
$this->RowAttrs["style"] = "background-color: red";

to:
$this->durationc->CellAttrs["style"] = "background-color: red";


johnberman
User
Posts: 210

Post by johnberman »

sorry but this works on the first row the condition is met and not on subsequent rows ?

function Row_Rendered() {
if ($this->Durationc->ViewValue == "") {// List page only
$this->RowAttrs["style"] = "background-color: orange";

}else{

$this->Durationc->CellAttrs["style"] = "background-color: red";

}

}

Regards
John B


mobhar
User
Posts: 11703

Post by mobhar »

Change:
$this->Durationc->ViewValue

to:
$this->Durationc->CurrentValue


johnberman
User
Posts: 210

Post by johnberman »

Thanks for you never ending patience

John B


Post Reply