⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Change row color based on value



mcl

mcl
  • profile picture
  • Member

Posted 20 September 2013 - 23:47 PM

Hello all,

 

New to grocery CRUD and i wish to do some color rendering.

I have a column which contain a date and i need the text or background to be in red if 72 hours have passed. I have done some search on google and on this forum but haven't found anything clear enough for me to understand.

I think i may need to use callback but no clue how to change color with it.

Can someone explan it to me or give some hints?

 

Newbie programmer, bear with me please :)

Your help is greatly appreciated on this issue.

 

 

 

 

 

 

 


davidoster

davidoster
  • profile picture
  • Member

Posted 21 September 2013 - 00:57 AM

Hello and welcome to the forums [member=mcl].

The easiest way to do this is by using the callback_column and change the text color of the date, like this for example :

http://www.w3schools.com/tags/att_font_color.asp

 

If you feel confident enough you can play with some custom CSS and apply it to the date cell using custom javascript.

This is some basic css http://www.w3schools.com/css/css_font.asphttp://www.w3schools.com/css/css_text.asp

 

 

Which one you will use is totally up to you.


mcl

mcl
  • profile picture
  • Member

Posted 30 September 2013 - 22:55 PM

Thank you @davidoster. I can see how to use callback but not dealing with the color rendering as im having another problem right now : /topic/2080-callback-after-update-condition-post-array/


fjcalvomacias

fjcalvomacias
  • profile picture
  • Member

Posted 21 January 2015 - 07:25 AM

Hi! im new in the forum and my english is....

 

JQUERY POWER!! parent().parent.().parent().......

 

i use callbackcolum and return ->

$dev = "<a href=\"JAVASCRIPT:ver_gastos('".$value."',".$row->id.")\" id='conte".$row->id."'>".$valor."</a>";
        if($fact["observaciones"]!=""){
            $dev.="<script>$('#conte".$row->id."').parent().parent().parent().css('background-color','#ff6f6f');</script>";
        }