specific column Conditional Formatting

Questionsspecific column Conditional Formatting
Gandharv asked 12 years ago

As i am using JQGrid in my project and want to show the column in green color when current date is between start date and end date. If the start date and end date is not between current date then it will display in red color.
So, for that how i write here.

In conditional formatting, example is showing that it will select whole row if i specify
$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':'Bisque'"; // must use (single quote ') with css attr and value
$f_conditions[] = $f;

and if i donot select column and op value then it will select whole column.

How to select any particular column?
Thanks for the reply.

15 Answers
Abu Ghufran answered 12 years ago

Hello,

Do you mean individual cell formatting based on content in it?

Abu Ghufran answered 12 years ago

I've emailed you sample code.

Gandharv answered 12 years ago

Hello sir,

The solution you sent that i already mentioned in my mail. I know how to put conditional formatting on whole row or whole column. I want to put on any particular cell inside the JQGrid.

Explanation:-
Suppose if current date comes between the start date and end date then only start_date, and end_date cell [not whole column] will come in green color if not then both cell [not whole column] will display in red color.

Waiting for your reply.
Thanks & Regards
Gandharv

Gary answered 12 years ago

Hi,
I am also looking for this fix.

Rgds
Gary

Gary answered 12 years ago

Or a way to make the css per rule – cumalative…?

Abu Ghufran answered 11 years ago

Hello Gary & Gandharv

I've emailed your fix.

Chao Shun Jenq answered 11 years ago

hello,
i am also looking for this fix,too.
may i get a copy?
Rgds

Abu Ghufran answered 11 years ago

Emailed, it's in package's file demos/appreaence/conditional-format.php

kim answered 10 years ago

how to create a condition where READONLY when 2nd field is < value of 10 but EDITABLE and REQUIRED when 2nd field is > value of 10!

tried using example of demos/appreaence/conditional-format.php
but not working.

any assitance would be appreciated.

Abu Ghufran answered 10 years ago

I've updated the lib, that now support it.

$col["editrules"] = array("required"=>true, "readonly"=>true, "readonly-when"=>array("client_id",">","8"));

Emailing you latest files.

kim answered 10 years ago

got the latest build…thank u.

question:
what am i doing wrong?
====================
2 fields below:
====================
$col = array();
$col["title"] = "Contract Worth";
$col["name"] = "contract_Worth";
$col["editable"] = true;
$col["editrules"] = array("currency" => true, "required" => false);
$col["editoptions"] = array("size" => 15); //1,000,000,000,000.00
$col["formatter"] = "currency";
$col["formatoptions"] = array("prefix" => "$", "suffix" => '', "thousandsSeparator" => ",", "decimalSeparator" => ".", "decimalPlaces" => '2');
$cols[] = $col;

$col = array();
$col["title"] = "Commission Date";
$col["name"] = "contract_CommissionDate";
$col["editrules"] = array("required"=>true, "readonly"=>true, "readonly-when"=>array("contract_Worth",">","150000"));
$col["formatter"] = "date";
$col["formatoptions"] = array("srcformat"=>'Y-m-d',"newformat"=>'m/d/Y', "opts" => array("changeYear" => false,"showOn"=>"none"));
$cols[] = $col;

kim answered 10 years ago

so sorry.
working now!

Abu Ghufran answered 10 years ago

After your requirement, I just added a callback function with readonly-when.
Emailing you the updated build and demo.

David answered 10 years ago

it is a very good new feature !!

any possibilities to pass array of resitricted value or separate with commas ?

$col["editrules"] = array("required"=>true, "readonly"=> true,"readonly-when"=>array("client_id","==","18,3,4,9"));

David answered 10 years ago

That's perfect Abu ,

Thank you very much

Your Answer

20 + 6 =

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 3 / 5. Vote count: 1

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?