Pending Review
Last Updated: 18 Nov 2024 17:24 by Simi
Simi
Created on: 18 Nov 2024 17:17
Category: UI for Blazor
Type: Feature Request
1
Add [CascadingTypeParameter(nameof(TItem))] to TelerikGrid for developer improvement with GridColumn

Steps to reproduce:

  1. Insert a simple TelerikGrid on your page
  2. Add Columns with templates for each property
  3. Specify a Column Template

See https://blazorrepl.telerik.com/GyPvFMFr00zLEEdG00

Problem / Inconvenience

  • Context has to be converted/cast before access to the each property is possible
  • Grid columns are not generic which makes them hard to use sometimes
  • Fields have to be specified by name (may lead to wrong names after changing)

Solution / Feature Request

  • Provide new generic columns (to ensure no current implementations break)
  • Add [CascadingTypeParameter(nameof(TItem))] to the TelerikGrid
  • GridColumns automatically "inherit" the typeparam TItem

Idea from: Blazor QuickGrid

Benefits

  • GridColumns can be specified with Expression
  • Template context does not have to be cast anymore
  • Renaming properties affect expression or an error is display (property does not exist)
<GridColumn For="@(t => t.Name)">
        <Template>
                <div>
                    @item.Name
                </div>
        </Template>
</GridColumn>
1 comment
Simi
Posted on: 18 Nov 2024 17:24

Of course I mean:

<GridColumn For="@(t => t.Name)">
        <Template>
                <div>
                    @context.Name
                </div>
        </Template>
</GridColumn>