Prerequisites
- Admin access to modify
risksheet.json(canAdminmust betrue) - Familiarity with the configuration editor
- Basic understanding of CSS properties (background-color, color, font-weight)
How Conditional Formatting Works
Conditional formatting in Risksheet uses a two-part system:cellDecorators--- JavaScript functions that evaluate cell data and toggle CSS classes on the cell elementstyles--- CSS class definitions that control the visual appearance applied by decorators
styles section injects those CSS classes into the page, controlling colors, fonts, and other visual properties.
Step 1: Define CSS Styles
Add named CSS class definitions to thestyles object in your risksheet.json. Each entry maps a CSS class selector to a string of CSS properties. The class name must start with a dot (.), and the CSS properties must be wrapped in curly braces.
RPN Threshold Styles
This example defines a three-tier color scheme for Risk Priority Number values:| CSS Class | Visual Effect | Typical Use |
|---|---|---|
.boldCol | Bold text (font-weight: 600) | Emphasize computed columns |
.rpn1 | Green background, dark green text | Low risk (RPN 1—150) |
.rpn2 | Amber background, dark amber text | Medium risk (RPN 151—350) |
.rpn3 | Red background, dark red text | High risk (RPN > 350) |
Header Group Styles
You can also define styles for column group headers using compound selectors:Step 2: Create Cell Decorator Functions
Add JavaScript functions to thecellDecorators object. Each decorator is keyed by the column binding it targets. The function receives an info object and uses jQuery’s toggleClass method to conditionally apply CSS classes.
RPN Column Decorator
- Always applies
boldCol(the second argumenttruemeans “always add”) - Applies
rpn1only when the value is between 1 and 150 - Applies
rpn2only when the value is between 151 and 350 - Applies
rpn3only when the value exceeds 350 - When a condition is
false,toggleClassremoves that class, ensuring only one threshold class is active at a time
Row Header Decorator
You can also apply conditional formatting to row headers using theheaders.rowHeader.renderer property. The row header decorator accesses data from the entire row:
The info Object in Cell Decorators
| Property | Type | Description |
|---|---|---|
info.value | any | The current cell’s display value after formula execution |
info.cell | DOM element | The cell’s HTML element (jQuery-wrapped via $(info.cell)) |
info.item | object | The full row data object with all column bindings as keys |
Enum Value Decorator
When decorating cells that contain enum values, compare against the enum ID (the internal identifier), not the display name:Step 3: Apply Static Column Styles
For columns that should always have a specific style (not conditional), use thecellCss property on the column definition instead of a decorator:
cellCss property applies the named CSS class to every cell in the column unconditionally. Use it for:
- Making all cells in a column bold
- Applying a fixed background color to a column group
- Adding a border or padding to specific columns
cellCss for static styles with cellDecorators for dynamic, value-based styles on the same column.
Step 4: Highlight Mandatory Fields Visually
Risksheet intentionally does not enforce Polarion mandatory field validation during data entry (to make risk entry faster). Instead, use conditional formatting to visually indicate which fields require values:Complete Configuration Example
Here is a fullrisksheet.json excerpt combining formulas, decorators, and styles for an FMEA risk analysis sheet:
Verification
After applying conditional formatting, you should now see:- ✅ RPN cells display with green, amber, or red backgrounds based on their computed values
- ✅ Row headers change color to match the revised RPN risk level
- ✅ Bold text appears on formula columns with the
boldColclass - ✅ Colors update automatically when risk parameter values change
- ✅ Conditional formatting is preserved in Excel exports (via
includeStyles)
The exact appearance of conditional formatting may vary depending on your browser, Polarion theme, and any custom CSS injected at the project level. Test your decorator functions with representative data covering all threshold ranges.
See Also
- Configure Cell Styles --- static cell styling with the
stylesobject - Configure Row Header Styles --- row header renderers and conditional row coloring
- Configure Item Colors --- row-level color coding based on work item properties
- Configure Calculated Columns --- formulas that produce the values decorators evaluate
- Work with Formulas and Hidden Columns --- formula execution and visibility interaction
- Create Custom Renderers --- advanced cell rendering beyond CSS classes
Sources
Sources
KB ArticlesSupport TicketsSource Code
AppConfig.tsrisksheet.jsonCellPreviewFormatter.tsCellEditorFormatter.tsExportToPdf.ts