Overview
Conditional formatting combines three configuration elements:- Cell Decorator — JavaScript function that evaluates cell data and applies CSS classes
- CSS Classes — Style definitions bound to those class names
- Cell Renderer Assignment — Links a column to its decorator function
Architecture Diagram
Configuration Structure
Cell Decorators Definition
| Property | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Unique identifier for the decorator function |
function | string | Yes | JavaScript function body (receives info parameter) |
condition | expression | No | Optional condition to determine which decorator applies |
Cell Decorator Functions
Every cell decorator receives aninfo object with the following properties:
| Property | Type | Description |
|---|---|---|
info.value | any | Current cell value |
info.item | object | Complete work item row data |
info.cell | DOM element | The cell DOM element to style |
info.row | number | Row index in the grid |
info.col | number | Column index in the grid |
Common Decorator Patterns
Pattern 1: Numeric Range ClassificationCSS Classes Definition
Every CSS class used by cell decorators must be defined in thestyles object:
| Property | Type | Default | Description |
|---|---|---|---|
.className | string | — | CSS style declaration as JSON string |
!important | flag | — | Required when multiple decorators might conflict on same cell |
Assigning Decorators to Columns
Link a cell decorator to a column using thecellRenderer property:
Critical Implementation Details
Always check for null/undefined values before accessing nested properties:
Cell Decorator Execution Timing
Decorators execute at these points:- Grid Initialization — Applied when RISKSHEET first loads
- Data Refresh — Re-applied when cells are edited and grid refreshes
- Row Addition — Applied when new rows are inserted
- Data Changes — Applied when linked data or formulas update
Multiple Decorators on One Column
A single column can use only onecellRenderer, but that renderer can apply multiple CSS classes to create complex styling:
styles object:
Troubleshooting
| Issue | Cause | Solution |
|---|---|---|
| Styling not appearing | CSS class not defined | Add class to styles object |
| Some cells styled, others not | Condition logic error | Check enum IDs vs values |
| Styling overwrites unexpectedly | Missing !important flag | Add !important to CSS declarations |
| Decorator function errors | Accessing undefined property | Add null checks: if (info.item['field'] !== null) |
| Performance slow with many cells | Too many DOM updates | Optimize condition logic; avoid complex calculations |
See Also
- Cell Decorators — Complete decorator function reference
- CSS Classes — System CSS classes and custom styling
- Apply Conditional Formatting — Step-by-step guide
- Configure Cell Styles — Interactive styling tutorial
Sources
Sources
KB ArticlesSupport TicketsSource Code
AppConfig.tsrisksheet.jsonSheetConstants.tsApprovalBasedReview.javaCellEditorFormatter.ts