formatter number or currency

Questionsformatter number or currency
Cristian Engelmann asked 4 years ago

Hi Abu,

how can I to formated number or currency?

Ex.

$col = array();
$col[“title”] = “Descuento”;
$col[“name”] = “descuento”;
$col[“width”] = “10”;
$col[“align”] = “right”;

if($row[‘tipodescuento’] == ‘%’)
{
$col[“formatter”] = “number”;
$col[“formatoptions”] = array(“prefix” => ”,”suffix” => ‘%’,”thousandsSeparator” => ‘.’,”decimalSeparator” => ‘,’,”decimalPlaces” => 2);
}
else
{
$col[“formatter”] = “currency”;
$col[“formatoptions”] = array(“prefix” => “$”,”suffix” => ”,”thousandsSeparator” => “.”,”decimalSeparator” => “,”,”decimalPlaces” => 2);
}

$col[“search”] = false; // this column is not searchable
$cols[] = $col;

 

Thank you

1 Answers
Abu Ghufran Staff answered 4 years ago

Hi,

You will need JS custom column formatter here. I am sending you demo code.

https://gist.github.com/gridphp/a699e0e7c4a0496befd60f9d3a70732c
Custom formatter based on row data – Line 66-84

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

9 + 15 =

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?