Search results

Hide empty headers in ASP.NET Core Pivot Table control

If the raw data for a particular field is not defined, it will be shown as ‘Undefined’ in the pivot table headers. You can hide those headers by setting the showHeaderWhenEmpty property to false in the pivot table.

For example, if the raw data for the field ‘Country’ is defined as “United Kingdom” and “State” is not defined means, it will be shown as “United Kingdom >> Undefined” in the header section. Here, you can hide those ‘Undefined’ header using the showHeaderWhenEmpty property.

By default, this property is set as true.

<ejs-pivotview id="PivotView" height="300" showFieldList="true">
    <e-datasourcesettings dataSource="@ViewBag.DataSource" expandAll="false" showHeaderWhenEmpty="false" enableSorting="true" allowLabelFilter="true" allowValueFilter="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" caption="Year"></e-field>
            <e-field name="Quarter"></e-field>
            <e-field name="Sold" caption="Units Sold"></e-field>
            <e-field name="Amount" caption="Sold Amount"></e-field>
public ActionResult Index()
    var data = GetPivotData();
    ViewBag.DataSource = data;
    return View();