Added new demo for css formatting of rows, based on certain conditional values. You need to define column,operator(cn/eq),value and css style for the row. It will highlight your grid rows as per your need.

This feature is currently available in paid package. Existing customers can request this demo when needed.

// conditional css formatting of rows

$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':'yellow'"; // must use (single quote ') with css attr and value
$f_conditions[] = $f;

$f = array();
$f["column"] = "invdate";
$f["op"] = "eq";
$f["value"] = "2007-10-31";
$f["css"] = "'background-color':'red', 'color':'white'";
$f_conditions[] = $f;

$f = array();
$f["column"] = "invdate";
$f["op"] = "cn";
$f["value"] = "2012";
$f["css"] = "'background-color':'lightgreen'";
$f_conditions[] = $f;

$g->set_conditional_css($f_conditions);

Above code result in following formatting …

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

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

Let us improve this post!

Tell us how we can improve this post?

3 Comments

  1. A couple of things:
    1. font-weight bold does not work
    2. Changing the background colour changes the colour of the border around part of the row/cell as well, but not the whole row/cell. Looks bad.

Leave a Reply