Conditional data

QuestionsConditional data
Mauro asked 8 years ago

Hi have two question:

1) change the text color based on value
0-50 red
51-81 blue
82-100 green
How can i do? I've used conditional formatting but i can't figure it out

2) change value based on db
Ex. the db give me the value "F" but in the grid i want "F" is trasformed into "First"

Thanks

2 Answers
Abu Ghufran answered 8 years ago

#1 Refer this demo code:
http://pastebin.com/HevurRGR

#2

I) Refer on_data_display event in demos/editing/custom-events.php
II) 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;
}
}

Abu Ghufran answered 8 years ago

If you wish to save data back to database with displaying full text,
It would be better to use dropdown that will POST 'F' and show 'First'.
Refer docs for details.

Your Answer

14 + 8 =

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?