show data based on php functions

Questionsshow data based on php functions
Mauro asked 8 years ago

How can i call a php function to display data?

The query return me some values, if the value is 20 there is a specific text to display

Example (this is my function outside the datagrid)

function Role($p, $printPunteggio = false)
{
if ($p['por'] == 20)
{
$s .= 'P';
return $s;
}
if ($p['lib'] == 20)
$s .= 'L';
if ($p['dif'] == 20)
$s .= 'D';
if ($p['med'] == 20)
$s .= 'M';
if ($p['cen'] == 20)
$s .= 'C';
if ($p['tre'] == 20)
$s .= 'T';
if ($p['att'] == 20)
$s .= 'A';
$s .= ' ';
if ($p['ce'] == 20)
$s .= 'C';
if ($p['la'] == 20)
$s .= 'L';
return $s;
}

How can i implement into the datagrid?
Thanks

1 Answers
Abu Ghufran answered 8 years ago

Pasting from docs:

For extended conditional data, you can also have callback function, that will allow you to display based on row data. For e.g.

$col["on_data_display"] = array("display_keyword","");

function display_keyword($data)
{
$kw = $data["keyword_name"];
$numKeywords = count(explode("n",$pass));
if ($numKeywords > 3)
return $numKeywords." Keywords";
else
{
$pass = str_replace("+"," ",$pass);
return $pass;
}
}

Your Answer

16 + 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?