ArtiGrid
conditional colors in cells and rows
Conditional Colors for Cells and Rows
This example shows how to apply conditional colors to specific cells or entire rows in an ArtiGrid table.
1. Apply Color to a Specific Cell
$grid->CellColor('officeCode', '==', 4, 'red');
This line sets the background color of the
officeCode column to red when its value is equal to 4.
2. Apply Color to an Entire Row
$grid->RowColor('employeeNumber', '==', 1370, '#8DED79');
This line highlights the entire row with a light green color (
#8DED79) if the employeeNumber is 1370.
3. Render the Table
$grid->table('employees');
echo $grid->render();
After setting the conditions, you call
render() to display the table with the conditional formatting applied.
Summary:
is used to color a specific column based on a condition.CellColor
is used to color an entire row based on a condition.RowColor- Conditions can use operators like
,==
,<
, etc.> - These features make it easy to highlight important data dynamically.