简体   繁体   English

如何使用bootgrid根据PHP json中的值更改行字体颜色或背景颜色

[英]how to change row font color or background color base on values in PHP json im using bootgrid

THIS IS MY PHP CODE how can i changed the font color of specific row based on the value这是我的 PHP 代码如何根据值更改特定行的字体颜色

$sql = "SELECT * FROM employee "; $sqlTot .= $sql; $sqlRec .= $sql;

    if(isset($where) && $where != '') {
        $sqlTot .= $where;
        $sqlRec .= $where;
    }

    if ($rp!=-1)
    $sqlRec .= " LIMIT ". $start_from .",".$rp;

    $qtot = mysqli_query($this->conn, $sqlTot) or die("error to fetch tot seaman's data");
    $queryRecords = mysqli_query($this->conn, $sqlRec) or die("error to fetch seaman's data");

    while( $row = mysqli_fetch_assoc($queryRecords) ) {
        $data[] = $row;
    }

        $json_data = array(
            "current"            => intval($params['current']),
            "rowCount"            => 10,
            "total"    => intval($qtot->num_rows),
            "rows"            => $data   // total data array
        );

        return $json_data;
    }

Add more details about your client-side code.添加有关客户端代码的更多详细信息。 according to comments, you can change your code to this one:根据评论,您可以将代码更改为:

...
while( $row = mysqli_fetch_assoc($queryRecords) ) {
    if ($you_want)
        $row['remarks'] = 'ACTIVE';
    $data[] = $row;
}
...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM