$npx -y skills add DevExpress/agent-skills --skill devexpress-blazor-pivot-table--- name: devexpress-blazor-pivot-table description: Build and configure the DevExpress Blazor Pivot Table (DxPivotTable) — an interactive pivot grid / cross-tab analysis component for Blazor. Use for pivot-style row/column aggregation (sum/count/avg/min/max), field layout (are
| 1 | # DevExpress Blazor Pivot Table |
| 2 | |
| 3 | `DxPivotTable` is an interactive cross-tabulation component for Blazor that aggregates data into row, column, data, and filter areas. It is designed for data analysis scenarios — sales by region and period, expenses by category, inventory by supplier. |
| 4 | |
| 5 | ## When to Use This Skill |
| 6 | |
| 7 | - Display data in cross-tabulation (pivot) form with rows and columns |
| 8 | - Aggregate values with Sum, Count, Average, Min, Max |
| 9 | - Group dates by Year, Quarter, or Month |
| 10 | - Enable end-users to drag fields between areas interactively |
| 11 | - Filter data across one or more dimensions |
| 12 | |
| 13 | ## Prerequisites & Installation |
| 14 | |
| 15 | ### NuGet Packages (two packages required) |
| 16 | |
| 17 | | Package | Purpose | |
| 18 | |---|---| |
| 19 | | `DevExpress.Blazor.PivotTable` | The Blazor PivotTable component | |
| 20 | | `DevExpress.PivotGrid.Core` | Core pivot engine (required dependency) | |
| 21 | |
| 22 | ```bash |
| 23 | # Install from NuGet.org: |
| 24 | dotnet add package DevExpress.Blazor.PivotTable |
| 25 | dotnet add package DevExpress.PivotGrid.Core |
| 26 | ``` |
| 27 | |
| 28 | ### Setup |
| 29 | |
| 30 | 1. Register in `Program.cs`: |
| 31 | ```csharp |
| 32 | builder.Services.AddDevExpressBlazor(); |
| 33 | ``` |
| 34 | > **v26.1 note**: `DevExpress.Blazor` no longer includes `options.BootstrapVersion` or `DevExpress.Blazor.BootstrapVersion`. Do not generate either API. |
| 35 | 2. Apply a theme and add client scripts in `App.razor` inside `<head>`: |
| 36 | ```razor |
| 37 | @using DevExpress.Blazor |
| 38 | @DxResourceManager.RegisterTheme(Themes.Fluent) |
| 39 | @DxResourceManager.RegisterScripts() |
| 40 | ``` |
| 41 | 3. Add **both** namespaces to `_Imports.razor`: |
| 42 | ```razor |
| 43 | @using DevExpress.Blazor |
| 44 | @using DevExpress.Blazor.PivotTable |
| 45 | ``` |
| 46 | |
| 47 | > **Important**: `@using DevExpress.Blazor.PivotTable` is required in addition to `@using DevExpress.Blazor`. Without it, `DxPivotTable` and `DxPivotTableField` are not resolved. |
| 48 | |
| 49 | ## Before You Start — Ask the Developer |
| 50 | |
| 51 | If the host agent has a structured question-asking tool available, use it to ask these questions one at a time with clear options — for example, Claude Code's `AskUserQuestion` tool or GitHub Copilot's `askQuestions` tool. If no such tool is available, ask the questions directly in the chat response before generating code. |
| 52 | |
| 53 | 1. **Data source**: What is the type of data being pivoted? (list of sales records, orders, etc.) |
| 54 | 2. **Render mode**: Are you using `InteractiveServer`, `InteractiveWebAssembly`, or `InteractiveAuto`? |
| 55 | 3. **Row and Column axes**: Which fields should appear on rows? Which on columns? |
| 56 | 4. **Aggregation**: What values should be summed/averaged? (e.g., Revenue, Quantity) |
| 57 | 5. **Date grouping**: Should dates be grouped by Year, Quarter, or Month? |
| 58 | |
| 59 | ## Component Overview |
| 60 | |
| 61 | `DxPivotTable` provides: |
| 62 | |
| 63 | - **Data Binding** (`Data`): Binds to `IEnumerable<T>` or `IQueryable<T>` |
| 64 | - **Field Configuration** (`DxPivotTableField` inside `<Fields>`): Defines which fields appear in which area, their order, aggregation type, and grouping interval |
| 65 | - **Areas** (`PivotTableArea`): Row, Column, Data, Filter |
| 66 | - **Date Grouping** (`PivotTableGroupInterval`): DateYear, DateQuarter, DateMonth, DateDay, DateHour |
| 67 | - **Aggregation** (`PivotTableSummaryType`): Sum, Count, Average, Min, Max |
| 68 | - **Interactive Field List**: Users can drag fields between areas at runtime |
| 69 | - **Filtering** (`PivotTableArea.Filter`): Filter fields display a filter-menu button in their header; users select/deselect values to filter table data; `FilterHeaderAreaDisplayMode` controls the filter header strip |
| 70 | - **Totals & Grand Totals** (`ShowRowTotals`, `ShowRowGrandTotals`, `ShowColumnTotals`, `ShowColumnGrandTotals`): Control row/column subtotals and grand totals visibility |
| 71 | |
| 72 | ### Core Entry Point (Razor) |
| 73 | |
| 74 | ```razor |
| 75 | @rendermode InteractiveServer |
| 76 | @using DevExpress.Blazor.PivotTable |
| 77 | |
| 78 | <DxPivotTable Data="@SalesData"> |
| 79 | <Fields> |
| 80 | <DxPivotTableField Field="@nameof(Sale.Country)" |
| 81 | Area="PivotTableArea.Row" /> |
| 82 | <DxPivotTableField Field="@nameof(Sale.OrderDate)" |
| 83 | Area="PivotTableArea.Column" |
| 84 | GroupInterval="PivotTableGr |