laravel-jqgrid icon indicating copy to clipboard operation
laravel-jqgrid copied to clipboard

Rows with different colors

Open KrasilnikovKB opened this issue 9 years ago • 1 comments

Are there examples for how to set the color of the line depending on the value in the column?

KrasilnikovKB avatar Feb 29 '16 16:02 KrasilnikovKB

a minimum of code, but it is not very convenient :

->setGridOption('rowattr','function (rd) { if (rd.column_name == "column_value") { return {"style": "background-color:#FFFF99;"}; }else{ return { "class": "myAltRowClass" }; } }')

or more readable (with preg_replace):

                      ->setGridOption('rowattr',preg_replace('/\s+/m', ' ', '
                            function (rd) {
                                if (rd.column_name == "column_value") {
                                    return {"style": "background-color:#FFFF99;"};
                                }else{
                                    return { "class": "myAltRowClass" };
                                }
                            }'
                      ))

class define:

    <style type="text/css">
        .ui-widget-content .myAltRowClass { background-color: #DCFFFF; color: blue;  background-image: none; }
    </style>

KrasilnikovKB avatar Apr 21 '16 05:04 KrasilnikovKB