Back to Devexpress

DxPivotTable.Reload() Method

blazor-devexpress-dot-blazor-dot-pivottable-dot-dxpivottable-8747d1c3.md

latest2.2 KB
Original Source

DxPivotTable.Reload() Method

Reloads Pivot Table data.

Namespace : DevExpress.Blazor.PivotTable

Assembly : DevExpress.Blazor.PivotTable.v25.2.dll

NuGet Package : DevExpress.Blazor.PivotTable

Declaration

csharp
public void Reload()

Remarks

Call the Reload method after the Pivot Table’s bound data source is changed. The method gets updated data from the source and applies changes to the Pivot Table.

The following code adds two buttons that allow you to add a new item to the data source and reload the Pivot Table data.

razor
<button @onclick="AddNewItem">Add a new item to the data source</button>
<button @onclick="ReloadPivotTable">Reload</button>

<DxPivotTable Data="@Data" @ref="pivotTable">
    <Fields>
        <DxPivotTableField Field="Region" 
                           Area="PivotTableArea.Row" />
        <DxPivotTableField Field="Country" 
                           Area="PivotTableArea.Row" />
        <DxPivotTableField Field="Date" 
                           Area="PivotTableArea.Column" 
                           GroupInterval="PivotTableGroupIntervalDateWeekOfMonth" 
                           Caption="WeekOfMonth" />
        <DxPivotTableField Field="OrderId" 
                           Area="PivotTableArea.Data" 
                           SummaryType="PivotTableSummaryTypeCount" />
    </Fields>
</DxPivotTable>

@code {
    List<SaleInfo> Data;
    IPivotTable pivotTable;

    protected override void OnInitialized() {
        Data = SaleInfo.GetAsia().ToList();
    }

    void AddNewItem() { 
        Data.Add(new SaleInfo() { Region = "Asia", Country = "Japan", Date = new DateTime(2020, 1, 1), OrderId = 100 });
    }

    void ReloadPivotTable() {
        pivotTable.Reload();
    }
}

Implements

Reload()

See Also

DxPivotTable Class

DxPivotTable Members

DevExpress.Blazor.PivotTable Namespace