conditional formatting errors

Questionsconditional formatting errors
Dennis denHollander asked 10 years ago

I'm using the following code for conditional formatting. If auth_num column is greater than 0, then the row gets a red background.

$fp = array();
$fp["column"] = "auth_num";
$fp["op"] = ">";
$fp["value"] = "0";
$fp["css"] = "'background-color':'red'";
$fp_conditions[] = $fp;

$gp->set_conditional_css($fp_conditions);

BUT — a few problems:
1) Now when I select a row with the red background, it doesn't get highlighted.
2) the rows with red background, the row icons for edit and delete are hidden. They are still there (you can still click the right spot) but you can't see the icons.

2 Answers
Abu Ghufran answered 10 years ago

It is recommended to use 'class' instead of 'css'.

$f = array();
$f["column"] = "name"; // exact column name, as defined above in set_columns or sql field name
$f["op"] = "cn"; // cn – contains, eq – equals
$f["value"] = "Ana";
// $f["css"] = "'background-color':'red'";
$f["class"] = "focus-row-2"; // css class name
$f_conditions[] = $f;

<body>
<style>
tr.focus-row-2
{
background: Bisque;
}
</style>

Full code: http://pastebin.com/Ag7uG4gH

Dennis denHollander answered 10 years ago

Fantastic — thank you!

Your Answer

2 + 4 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?