JavaScript display functions are an advanced customization technique. Before using them, ensure you are comfortable with adding columns and configuring formatters.
Understand render vs display vs renderers
Powersheet offers three properties for controlling cell output. Each serves a distinct purpose:| Property | Location | Purpose | Modifies data? |
|---|---|---|---|
display | Column definition | Select which property of a linked entity to show, or use a JS function for custom output | No |
render | Column definition | Reference a named renderer or inline JS expression for custom HTML | No |
renderers | Root-level section | Define reusable named renderer functions | No |
Use display for property selection
The simplest use ofdisplay is selecting which property of a linked entity to show. For scalar navigation properties (n-to-1 relationships), set it to a property name string:
title property of the linked Hazard entity instead of the default identifier.
Use display with a JavaScript function
For dynamic cell content, setdisplay to a JavaScript arrow function string. The function receives a context object and should return an HTML string:
> (folded scalar) indicator for multi-line function strings:
Use render for custom HTML
Therender property provides custom HTML rendering for a column. It accepts either an inline JavaScript expression or a reference to a named renderer:
Inline expression:
Use
display when you need to select which property of a navigation property to show, or to format it with JavaScript. Use render when you need custom HTML rendering for any column type. When both are set on the same column, render takes precedence for visual output.Define reusable renderers
Therenderers section at the root level of the sheet configuration defines named renderer functions. Each renderer is a JavaScript arrow function string with access to the context object:
render property:
Customize picker display
Thelist.display property customizes how items appear in dropdown pickers, not in the cell itself:
Context object reference
Dynamic expressions receive acontext object. The available properties depend on the evaluation location:
| Property | Available in | Description |
|---|---|---|
context.value | render, display, renderers | The current cell value |
context.item | render, display, renderers, formula, formatter | The entity object for the current row |
context.item.id | All per-cell contexts | The work item ID |
context.item.projectId | All per-cell contexts | The project ID |
context.document | formatter | Current document information |
context.source | formula, display | Parent entity in relationship contexts |
context.entity | formula | Current entity as a plain object |
Complete YAML example
Verify
After saving the sheet configuration, reload the powersheet document. You should now see cells rendering custom HTML content — bold text, formatted identifiers, or concatenated values — according to the JavaScript functions you defined. Columns usingrender or display functions will show the transformed output instead of raw property values.
See also
- Add a Column — column basics and property binding
- Configure a Formatter — conditional styling with expressions
- Configure Dynamic Expressions —
formula,() =>syntax, and the context object - Sheet Configuration Reference — full property reference
- Sheet Configuration Guides