Format cell content

QuestionsFormat cell content
Fabio Martins asked 11 years ago

Hi,

How can I format individual cell based on content in it?

I'm using:
$f = array();
$f["column"] = "deb";
$f["op"] = "eq";
$f["value"] = "0.00";
$f["css"] = "'color':'#FF0000'";
$f_conditions[] = $f;
$g – set_conditional_css($f_conditions);

But full row is red (font-color) and not only cell's content equal to "0.00".

Thank you!

6 Answers
Abu Ghufran answered 11 years ago

Use cellcss OR cellclass properties for cell only formatting.

// highlight cell, if defined cellclass OR cellcss
$f = array();
$f["column"] = "id";
$f["op"] = "=";
$f["value"] = "12";
// $f["cellcss"] = "'background-color':'red'"; // this also work
$f["cellclass"] = "focus-cell";
$f_conditions[] = $f

Fabio Martins answered 11 years ago

Hi Sir,

Your example didn't work to me (the cell didn't change the color).

Thank you!

Abu Ghufran answered 11 years ago

I've emailed you latest build along with working demo.

Fabio Martins answered 11 years ago

I updated jqgrid_dist.php to "version 1.5.0 build 167-20130830" but the code below didn't work:

// highlight cell, if defined cellclass OR cellcss
$f = array();
$f["column"] = "id";
$f["op"] = "=";
$f["value"] = "12";
// $f["cellcss"] = "'background-color':'red'"; // this also work
$f["cellclass"] = "focus-cell";
$f_conditions[] = $f

Thank you!

Fabio Martins answered 11 years ago

Problem solved!
Thank you by your support!

varun answered 11 years ago

can i get this copy too?

Your Answer

14 + 16 =

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?