CleanCodeJN.GenericApis.DataGrid 1.2.0

dotnet add package CleanCodeJN.GenericApis.DataGrid --version 1.2.0
                    
NuGet\Install-Package CleanCodeJN.GenericApis.DataGrid -Version 1.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CleanCodeJN.GenericApis.DataGrid" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CleanCodeJN.GenericApis.DataGrid" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="CleanCodeJN.GenericApis.DataGrid" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CleanCodeJN.GenericApis.DataGrid --version 1.2.0
                    
#r "nuget: CleanCodeJN.GenericApis.DataGrid, 1.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CleanCodeJN.GenericApis.DataGrid@1.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CleanCodeJN.GenericApis.DataGrid&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=CleanCodeJN.GenericApis.DataGrid&version=1.2.0
                    
Install as a Cake Tool

CleanCodeJN.GenericApis.DataGrid

A generic, server-side MudBlazor table component for CleanCodeJN.GenericApis.

Drop <CCJNDataGrid> onto any Blazor page and point it at your GraphQL endpoint — columns, types, paging, sorting and search are all handled automatically.

Requirements

  • The backend must use CleanCodeJN.GenericApis with HotChocolate's auto-wiring (UseProjection, UseFiltering, UseSorting)
  • MudBlazor must be configured in the host app (wwwroot/index.html / App.razor)

Installation

dotnet add package CleanCodeJN.GenericApis.DataGrid

Setup

Register the services in Program.cs:

builder.Services.AddCleanCodeJNDataGrid();

This registers MudServices, the named HttpClient and GraphQLDataGridService in one call.

Add the MudBlazor layout components to your App.razor or MainLayout.razor if not already present:

<MudThemeProvider />
<MudPopoverProvider />
<MudDialogProvider />
<MudSnackbarProvider />

Usage

@using CleanCodeJN.GenericApis.DataGrid.Components

<CCJNDataGrid TDto="CustomerGetDto"
              GraphQLEndpoint="https://your-api/graphql"
              EntityName="customer"
              Title="Customers" />

EntityName is the lowercase GraphQL query field name — matches typeof(TEntity).Name.ToLowerInvariant() as generated by AutoQueryTypeExtensions.

Parameters

Parameter Type Required Default Description
GraphQLEndpoint string yes Full URL of the GraphQL endpoint
EntityName string yes Lowercase GraphQL query field name (e.g. "customer")
Title string no "" Heading rendered above the table
Searchable bool no true Show the search text field
Dense bool no false Compact row height
Striped bool no true Alternating row colours
Elevation int no 2 MudPaper shadow elevation
BearerToken string? no null Forwarded as Authorization: Bearer … header
ExcludedProperties HashSet<string> no [] DTO property names to hide (e.g. navigation properties)
PageSizeOptions int[] no [10,25,50,100] Page-size choices in the pager footer
ColumnHeaders Dictionary<string,string>? no null Custom column headers — maps property name → display label

Column auto-detection

Columns are discovered automatically from the DTO via reflection. Scalar types are included; complex objects and collections are skipped.

Supported types: string, bool, char, byte, short, int, long, float, double, decimal, DateTime, DateTimeOffset, DateOnly, TimeOnly, TimeSpan, Guid, and all enum types (including nullable variants).

Property names are converted to headers by inserting spaces before each capital letter (FirstNameFirst Name). Override any header via ColumnHeaders.

The search field queries all scalar columns simultaneously via a single GraphQL where: { or: [...] } clause:

  • String columnscontains (case-insensitive, server-side)
  • Numeric / Guid / bool columnseq (only applied when the search term is parseable as that type)

Search fires 500 ms after the last keystroke (debounce). The clear button resets immediately.

Example with all options

<CCJNDataGrid TDto="InvoiceGetDto"
              GraphQLEndpoint="@Endpoint"
              EntityName="invoice"
              Title="Invoices"
              Searchable="true"
              Dense="true"
              Striped="false"
              Elevation="4"
              BearerToken="@_token"
              ExcludedProperties="@(new HashSet<string> { "Customer", "InternalNotes" })"
              PageSizeOptions="@(new[] { 5, 10, 25 })"
              ColumnHeaders="@(new Dictionary<string, string>
              {
                  ["Id"]         = "Invoice ID",
                  ["CustomerId"] = "Customer",
                  ["Amount"]     = "Amount (€)",
              })" />

Programmatic reload

Expose a reference to the component and call ReloadTable() from code:

<CCJNDataGrid @ref="_grid" TDto="CustomerGetDto" ... />

@code {
    private CCJNDataGrid<CustomerGetDto> _grid = default!;

    private async Task Refresh() => await _grid.ReloadTable();
}

License

MIT

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.0 63 3/31/2026
1.1.0 68 3/30/2026
1.0.0 76 3/27/2026

Added Validation support for the MudBlazor DataGrid component, allowing you to easily integrate FluentValidation rules into your data grid
     operations. This enhancement ensures that your data grid can provide immediate feedback on user input, improving the overall
     user experience and data integrity when working with CleanCodeJN.GenericApis. Needs to use CleanCodeJN.GenericApis v6.2.6 or higher for the new FluentValidation extensions.