Skip to content

b-straub/Grid.Blazor

 
 

Repository files navigation

Grid.Blazor

A fork from: https://gridmvc.codeplex.com/

It supports .NET Core 3.1 and Blazor WebAssembly 3.2.0 Preview 1

Notes

  • Versions before GridBlazor 1.3.9 had the keyboard navigation enabled by default. This feature requires to focus on the grid element, but it can create problems when used on pages with 2 or more grids. As a consequence, starting with version 1.3.9 it has to be explicitly configured for each grid that requires keyboard navigation. Users can enable keyboard navigation between pages using the SetKeyboard method of the GridClient object:

        var client = new GridClient<Order>( ... ).SetKeyboard(true);
  • Grid components have been moved to GridBlazor.Pages folder in GridBlazor 1.3.2. You must add a reference to this namespace in the _Imports.razor:

        @using GridBlazor.Pages
  • Blazor Server App require these changes on to the _Host.cshtml file for .Net Core 3.1:

        <link href="_content/GridBlazor/css/gridblazor.min.css" rel="stylesheet" />
        <script src="_content/GridBlazor/js/gridblazor.js"></script>
  • Blazor WebAssembly projects require these changes on to the wwwroot/index.html file for version 3.2.0 Preview 1:

        <link href="_content/GridBlazor/css/gridblazor.min.css" rel="stylesheet" />
        <script src="_content/GridBlazor/js/gridblazor.js"></script>
  • Blazor WebAssembly projects require to use a new constructor of the GridClient object including an HttpClient object from Dependency Injection for .Net Core 3.1:

        @page "/..."
        @inject HttpClient httpClient
    
        ...
    
        protected override async Task OnParametersSetAsync()
        {
            ...
            var client = new GridClient<Order>(httpClient, url, query, false, "ordersGrid", Columns);
            ...
        }
    
  • The button to clear all filters is disabled by default starting from GridBlazor version 1.3.6. You can enable it using the ClearFiltersButton method of the GridClient object:

        var client = new GridClient<Order>(httpClient, url, query, false, "ordersGrid", Columns).ClearFiltersButton(true);

Demo

http://gridblazor.azurewebsites.net

Folder description

The SQL Server database for all demos can be downloaded from here

Alternatively, if you prefer to install a fresh version of the database you can perform the following steps:

  • run this script from Microsoft web to create a new database: https://github.com/microsoft/sql-server-samples/blob/master/samples/databases/northwind-pubs/instnwnd.sql
  • add a column to the Customers table with the name IsVip of type bit (NOT NULL) and default value 0:
        USE Northwind;
        ALTER TABLE dbo.Customers ADD IsVip bit NOT NULL DEFAULT 0 WITH VALUES;
        GO
  • change manually some values of the new IsVip column to True
  • review the datetime columns. Any missmatch between EF Core model and database definitions will produce an exception and filtering will not work as expected. If database columns are defined as datetime you must modify the NorthwindDbContext class including:
        modelBuilder.Entity<Order>().Property(r => r.OrderDate).HasColumnType("datetime");
    for each datetime column. Or you can change all database columns' type to datetime2(7).

Documentation

There are native C# Grid components for Blazor client-side and server-side, and for ASP.NET Core MVC.

You can find the specific documentation for each environment clicking the following links:

This is an example of a table of items using this component:

Image of GridBlazor

About

Grid component with CRUD for Blazor (client-side and server-side) and ASP.NET Core MVC

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 63.6%
  • HTML 27.7%
  • JavaScript 8.0%
  • CSS 0.7%