- Cell decorators — JavaScript functions that toggle CSS classes on cells. Functions live in the
cellDecoratorssection of the sheet configuration; columns reference them via thecellRendererproperty. - Custom cell renderers — JavaScript functions that replace cell HTML content entirely. Functions live in the
cellRendererssection of the sheet configuration; columns also reference them via thecellRendererproperty.
1
Define a Cell Decorator Function
Cell decorators are JavaScript functions registered in the This example applies CSS classes based on RPN (Risk Priority Number) value thresholds:
cellDecorators section of the sheet configuration. Each function receives an info object and uses jQuery to toggle CSS classes on the cell element based on data values.The info object provides:Add a decorator to the
cellDecorators section:boldCol— always applied (bold text)rpn1— applied when value is 1 to 150 (low risk)rpn2— applied when value is 151 to 250 (medium risk)rpn3— applied when value exceeds 250 (high risk)
You can define as many named decorators as needed in the
cellDecorators object. Each column can reference a different decorator via the cellRenderer property.2
Define Matching CSS Styles
Create CSS class definitions in the
styles section of the sheet configuration to define the visual appearance applied by your decorators. Style names must be valid CSS selectors prefixed with a dot, and the rule body MUST be wrapped in braces:3
Apply Decorators to Columns
Reference your decorator on a column using the The same decorator can be applied to multiple columns. In the example above, both the initial RPN and the revised RPN columns use the same
cellRenderer property. The value is the name of a function in the cellDecorators section. This activates the decorator for all cells in that column:rpn decorator for consistent color coding.The column-level property is named
cellRenderer, but the function it references is registered in the cellDecorators section of the sheet configuration. This is the standard pattern verified in production configurations and KB article #48001172969 — the column property and the registration section have different names by design.4
Configure a Row Header Renderer
Use The row header renderer accesses
headers.rowHeader.renderer to apply conditional styling to the row header (the leftmost column showing row numbers). The renderer references a function registered in the cellDecorators section. Row header decorators use the same $(info.cell).toggleClass(...) jQuery form as cell decorators, which is what the product’s reference templates use:info.item to read any property from the row’s work item. In this example, it reads the revised RPN value (rpnNew) to color the row header based on the post-mitigation risk level, providing at-a-glance risk assessment for each row.Row Header Rendering Flow:headers.rowHeader.renderer cellDecorators.rowHeaderRpnNew styles.rpn1 / rpn2 / rpn3
────────────────────────── ─► ────────────────────────────── ─► ───────────────────────────
references decorator name function evaluates row data CSS classes applied to cell5
Register Custom Cell Renderers
For complete control over cell display — replacing the default rendering entirely rather than adding CSS classes — register custom cell renderer functions in the Reference the renderer on a column:
cellRenderers section of the sheet configuration. Custom cell renderers differ from cell decorators:The column-level property name is the same in both cases (
cellRenderer), but the function it points to lives in a different registration namespace. Risksheet resolves the reference by looking up the function name in both sections.Custom renderers receive four parameters and can modify the cell appearance completely:cellDecorators and cellRenderers are distinct registration sections — they are not the same namespace. If you give a decorator and a renderer the same name, the column’s cellRenderer reference will resolve to one of them depending on lookup order. Use descriptive, distinct names to avoid ambiguity (e.g., rpn for decorators, statusIcon for renderers).6
Style Column Group Headers
Use styles with Apply the CSS class to a column’s header group:
.firstRow and .lastRow selectors to differentiate column group header appearance. This is useful when organizing columns into header groups:Complete Configuration Example
A full sheet configuration snippet combining cell decorators, styles, row header renderer, and column configuration:Verification
You should now see:- RPN cells colored green, yellow, or red based on their calculated values
- Bold text applied to all RPN cells via the
boldColclass - Row headers colored according to the revised RPN value for at-a-glance risk assessment
- Column group headers with differentiated styling for first and last rows (if configured)
- No JavaScript errors in the browser developer console (
F12)
rpn1, boldCol) are present on the cell’s DOM element.
See Also
- Apply Conditional Formatting — broader conditional formatting patterns beyond cell decorators
- Configure Cell Styles — CSS style definition reference
- Configure Row Header Styles — row header customization options
- Render Custom Data — data rendering patterns for columns
- Cell Decorators — reference documentation for cell decorators
- Conditional Formatting — conditional formatting reference
- Custom Renderer Templates — template reference for renderers