Conditional formatting based on a number range
This example uses the conditional operator
? to apply a class (
sp-field-severity--warning) to the parent
<div /> element when the value in the current field is less than or equal to 70. This causes the field to be highlighted when the value is less than or equal to 70, and appear normally if it's greater than 70.
- This format can be applied to a Number column
|1.0||November 2, 2017||Initial release|
|1.1||August 20, 2018||Switched to Excel-style expressions|
THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
This sample is also covered in the main documentation around the Column Formatting
An additional version using Abstract Tree Syntax (AST) is also provided for environments where the Excel-style expressions are not supported.