Hi Sir,
Is it possible format a currency negative value to:
(1.000,00) and not -1.000,00
My column code:
//COLUNA DO SALDO
$col = array();
$col["title"] = "Saldo (R$)";
$col["name"] = "saldo";
$col["align"] = "right";
$col["formatter"] = "currency";
$col["formatoptions"] = array("prefix" = "");
And negative values are displayed (for example): -234,00
Thank you!!!
Fábio Martins
You might have to use custom formatter, e.g.
in php code …
$col = array();
$col["title"] = "Price";
$col["name"] = "price";
$col["width"] = "50";
$col["editable"] = true;
$col["formatter"] = "function(cellvalue, options, rowObject){ return formatPrice(cellvalue, options, rowObject);}";
and in html …
<script>
function formatPrice(cellvalue, options, rowObject)
{
if (cellvalue < 0)
return '('+cellvalue+')';
else
return cellvalue;
}
</script>
<div style="margin:10px">
<?php echo $out?>
</div
Hi Sir!
Your example sometimes works (it returns currency value formatted), but in other no (it returns undefined)!
I'm searching possible erros on my php code.
Congratulations! PHPgrid is very good!!!
Thank you!
Fábio Martins