Zero values to empty strings

QuestionsZero values to empty strings
Fabio Martins asked 11 years ago

Hi,

Is it possible "0,00" values to "" (empty string) on grid load?

For example:

0,00 12,80
13,00 0,00

to

12,80
13,00

Thank you!
Fábio

1 Answers
Abu Ghufran answered 11 years ago

If this data is coming from DB, then you can use on_data_display filter to replace it.

For e.g. to make some string uppercase on grid display, we can have code like.

$e["on_data_display"] = array("filter_display", null, true)
$grid->set_events($e)

function filter_display($data)
{
/*
These comments are just to show the input param format
Array
(
[params] => Array
(
[0] => Array
(
[client_id] => 1
[name] => Client 1
[gender] => My custom malea
[company] => My custom Client 1 Company 1
)

[1] => Array
(
[client_id] => 2
[name] => Client 2
[gender] => male
[company] => Client 2 Com2pany 11
)

…….
*/
foreach($data["params"] as &$d)
{
$d["gender"] = strtoupper($d["gender"]);
}

Your Answer

20 + 0 =

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?