Search results

Apply conditional formatting for specific row or column

You can apply conditional formatting for specific row or column using label option in the pivot table. It can be configured using the conditionalFormatSettings option through code behind, during initial rendering. The required settings are:

  • label: Specifies the header name to apply conditions for row or column.
  • condition: Specifies the operator type such as equals, greater than, less than, etc.
  • value1: Specifies the start value.
  • value2: Specifies the end value.
  • style: Specifies the style for the cell.

To use the conditional formatting feature, You need to inject the ConditionalFormatting module in pivot table.

<ejs-pivotview id="PivotView"  width="100%" height="300" allowConditionalFormatting="true" showFieldList="true">
                <e-datasourcesettings dataSource="@ViewBag.DataSource" expandAll="false" enableSorting="true">
                        <e-field name="Amount" format="C0" maximumSignificantDigits="10" minimumSignificantDigits="1" useGrouping="true"></e-field>
                        <e-field name="Country"></e-field>
                        <e-field name="Products"></e-field>
                        <e-field name="Year"></e-field>
                        <e-field name="Order_Source" caption="Order Source"></e-field>
                        <e-field name="In_Stock" caption="In Stock"></e-field>
                        <e-field name="Sold" caption="Units Sold"></e-field>
                        <e-field name="Product_Categories" caption="Product Categories"></e-field>
                        <e-format label="Germany" conditions="Between" value1="500" value2="50000">
                            <e-fieldlist-style backgroundColor="#f48fb1" color="black" fontFamily="Tahoma" fontSize="12px" />
                <e-gridSettings columnWidth="100"></e-gridSettings>
public ActionResult Index()
    var data = GetPivotData();
    ViewBag.DataSource = data;
    return View();