Original Code:https://gist.github.com/gridphp/6d0d3f720e491261bb43aadded5b6042
Modified code: https://gist.github.com/rmkurzban/4c7c54522b5afc657744e527c531b75a
The orginal code has a typo on line 110 is $html .= “<td class=\”barcode\” $shade>$d</td>”;
should be $html .= “<td class=\”xbarcode\” $shade>$d</td>”;
Missing x in class.
I trying to have conditional color in PDF. I was able to add code for color in the PDF render but it does not come out in the PDF. If the comment is removed from line 148 //phpgrid_error($html); The return does have color. Also I have add new field to client table see lines13 -14 and the column code 62-79 this works for the grid but for the render and normal PDF the No is a 0 and Yes works okay.
In your modified code:
Line 128: For color export, set inline style instead of class. Also use double quotes OR \” to define styles as below.
$html .= "<tr" . ($v['is_active'] === "Yes" ? " style=\"color:#ff0000\">" : ">");
Ref: https://tcpdf.org/examples/example_048/
PS: thanks for identifying typo
For your second issue, showing 0 instead of No, You need to modify lib/inc/jqgrid_dist.php
Search this block:
if (!empty($rec[$cm[“name”]]))
and replace with:
if ($rec[$cm[“name”]] != ”)
Full code block:
// dropdown mappings
if ($cm["edittype"] == "select" && $cm["formatter"] == "select" && isset($cm["editoptions"]["value"]))
{
$rec[$cm["name"]] = trim($rec[$cm["name"]]);
if ($rec[$cm["name"]] != '')

