This sample demonstrates formatting the appearance of pivot table cells with user-defined styles based on applied conditions. The Conditional Formatting dialog is invoked to add conditions and styles for the conditions. The formatting can be added, removed, and reset dynamically as well.
Conditional formatting works only for cells with values,
allowing the users to change its appearance such as background color, font color, font family, and font size based on specific conditions.
Conditional formatting can be applied either through UI or code behind. To enable this option in UI, set
allowConditionalFormatting to true and invoke
showConditionalFormattingDialog method to view the UI.
To achieve this in code-behind, set
allowConditionalFormatting to true and use the
conditionalFormatSettings object in the pivot table along with the following properties.
Both options are enabled in this sample.
||Specifies the value field name for which style will be applied.|
||Specifies the operator type like equals, greater than, less than, etc.|
||Specifies the start value.|
||Specifies the end value.|
||Specifies the style for the cell.|
Also, user can clear the entire style applied for the value cell using reset all option.
The pivot table features are segregated into individual modules.
To enable conditional formatting, inject
ConditionalFormatting module using the