laravel-jqgrid
laravel-jqgrid copied to clipboard
Rows with different colors
Are there examples for how to set the color of the line depending on the value in the column?
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>