簡體   English   中英

如何使用bootgrid根據PHP json中的值更改行字體顏色或背景顏色

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

這是我的 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;
    }

添加有關客戶端代碼的更多詳細信息。 根據評論,您可以將代碼更改為:

...
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