VaclavElias / QuickGridToolkit

The QuickGrid Toolkit is a powerful set of components and utilities that builds upon the QuickGrid Blazor component, providing additional functionality for data display and manipulation.
MIT License
11 stars 0 forks source link

QuickGridToolkit

This toolkit should help you to use the QuickGrid with more functionality, specifically, if the QuickGrid is used in multiple places, with similar data structure, but with different columns.

Example:

<h1>Users</h1>
<div class="my-3">
    <ColumnSelector ColumnManager="_columnManager" SelectionChanged="SelectionChangedAsync" />
</div>
<QuickGrid @ref="_grid" Items="@_items.AsQueryable()" Class="table table-sm table-index table-striped small table-blazor table-fit table-thead-sticky mb-0" Theme="twentyAI">
    @QuickGridColumns.Columns(_columnManager)
</QuickGrid>

@code {
    private List<UserDto> _items = new();
    private ColumnManager<UserDto> _columnManager = new();
    private QuickGrid<UserDto>? _grid;

    protected override void OnInitialized()
    {
        _columnManager.AddIndexColumn();
        _columnManager.Add(new() { Property = p => p.Id });
        _columnManager.Add(new() { Property = p => p.Name });
        _columnManager.Add(new() { Property = p => p.Age });
        _columnManager.AddCountry();

        _items = UserService.GetUsers();
    }

    private async Task SelectionChangedAsync()
    {
        if (_grid is null) return;

        await _grid.RefreshDataAsync();
    }
}

Current Issues