CSS – How to test an empty field?

QuestionsCSS – How to test an empty field?
Benjamin asked 10 years ago

Hi,

I use this …

$f = array();
$f["column"] = "glf_note";
$f["op"] = "cn";
$f["value"] = "guy";
$f["css"] = "'background-color':'#8BE5E6'";
$f_conditions[] = $f;
$grid->set_conditional_css($f_conditions);

… it works fine. Now I would like to highlight a line when glf_note is not empty. What can I use as "op" and "value" ?

I tried "op" = "<>" … "!=" … it doesn't work …

Thanks.

6 Answers
Abu Ghufran answered 10 years ago

To have not empty formatting, use:

$f = array();
$f["column"] = "glf_note";
$f["op"] = "!=";
$f["value"] = "''"; // value is ' ' (non spaced)
$f["css"] = "'background-color':'#8BE5E6'";
$f_conditions[] = $f;

Benjamin answered 10 years ago

I copy/pasted this … it doesn't work. It has highlighted all lines.
Do I miss something ?

Thanks,

Abu Ghufran answered 10 years ago

Hello,

I rechecked and verified it again. if name has blank value, this would highlight the row.

$f = array();
$f["column"] = "name";
$f["op"] = "=";
$f["value"] = "";
$f["css"] = "'background-color':'red'"; // this also work
$f_conditions[] = $f;

Benjamin answered 10 years ago

ooops … I accidently rated to -1 … sorry … 🙁

Your last suggestion works fine but the problem is I need to test the exception. The field is most of time empty that's why I need to highlight it in case of some users commented it (if it is not empty) ..

Is it possible to test it in $e["on_data_display"] ??
If not, no matter, I will put a default value in it to solve this.

Thanks,

Abu Ghufran answered 10 years ago

Emailed you a working demo and lib update.

Benjamin answered 10 years ago

… so Happy ! that's work fine.

Many thanks Abu.

Your Answer

19 + 13 =

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?