Row background color based on criteria

Discuss MySQL Ajax Table Editor

Row background color based on criteria

Postby bizman » Wed Dec 05, 2012 11:59 am

Hi,

Is it possible to change the row background color based on certain condition?

I have a Mysql Table that holds records of commercial transactions and with respective status - Paid / Unpaid / Billed / Unbilled

I would like each status to be highlighted with different background colors for easy identification, say - Paid (Green) , Unpaid (Red), ....
bizman
 
Posts: 2
Joined: Wed Dec 05, 2012 11:48 am

Re: Row background color based on criteria

Postby KarelB » Wed Dec 12, 2012 5:37 am

Yes this is possible.
In the initiateEditor function caal this callback:
Code: Select all
$this->Editor->setConfig('modifyRowSets',array(&$this,'changeBgColor'));


en the callback function itself is something like:
Code: Select all
   
function changeBgColor($rowSets,$rowInfo,$rowNum)
{
   if ($rowInfo['status'] = "paid'){
      $rowSets['bgcolor']= 'green';
   } else if .....
.......
...
   return $rowSets;
}
KarelB
 
Posts: 458
Joined: Mon Dec 01, 2008 11:49 pm
Location: The Netherlands

Re: Row background color based on criteria

Postby scottdia » Mon Sep 28, 2020 3:19 pm

This code did not work for me. I tried the following and was successful:

function changeBgColor($rowSets,$rowInfo,$rowNum)
{
if ($rowInfo['status'] = "paid"){
$rowSets['style'] = "background-color: red;";
} else if .....
.......
...
return $rowSets;
}
scottdia
 
Posts: 7
Joined: Wed Sep 07, 2016 8:01 pm


Return to Open Discussion

Who is online

Users browsing this forum: Google [Bot] and 11 guests

cron