Skip to content

DataGrid/PropertyColumn use DisplayAttribute value for enum but doesn't support nullable value #2345

Closed

Description

Feature from Fluent UI Blazor 4.9

[DataGrid] Make PropertyColumn use DisplayAttribute value for enum (#2304)

supports enum types but does not support nullable enum types. DataGrid works correctly for example data

public enum Positions
{
    employee,
    [Display(Name = "HR Manager (DA)")]
    HrManager,
    [Display(Name = "Project Manager (DA)")]
    ProjectManager,
    [Display(Name = "Administrator (DA)")]
    Administrator
}



public class Employee
{
    [Display(Name = "Id")]
    public int Id { get; set; }
    [Display(Name = "Position")]
    public Positions Position { get; set; }
}

but DataGrid/PropertyColumn does not recognize nullable enum property (Position? Positions) as enum and attribute Display is ignored.

public class Employee
{
    [Display(Name = "Id")]
    public int Id { get; set; }
    [Display(Name = "Position")]
    public Positions? Position { get; set; }
}

Activity

  1. added
    triage
    on Jul 9, 2024
  2. added
    bug
    and removed
    triage
    on Jul 9, 2024
  3. added this to the v4.9.1 milestone on Jul 9, 2024
  4. added a commit that references this issue on Jul 9, 2024
    46a069c
  5. added a commit that references this issue on Jul 10, 2024
    25d1e28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions