MASA.Blazor icon indicating copy to clipboard operation
MASA.Blazor copied to clipboard

[Bug Report] MDataTable 中DataTableHeader 无法绑定子对象(套嵌)

Open a56209 opened this issue 4 months ago • 2 comments

Masa.Blazor version

1.9.4

Hosting model

Blazor Server

Describe the bug

public sealed class ApartmentDto
{
    public Guid Id { get; init; }

    public string Name { get; init; }

    public string Description { get; init; }

    public AddressDto Address { get; set; }
}

// 绑定后Address对象无法显示
private List<DataTableHeader<ApartmentDto>> _headers = new List<DataTableHeader<ApartmentDto>>
    {
       new ()
       {
        Text= "ID",
        Align= DataTableHeaderAlign.Start,
        Sortable= false,
        Value= nameof(ApartmentDto.Id)
      },
      new (){ Text= "名称", Value= nameof(ApartmentDto.Name)},
      new (){ Text= "描述", Value= nameof(ApartmentDto.Description)},
      new (){ Text= "价格", Value= nameof(ApartmentDto.Price)},
      new (){ Text= "货币", Value= nameof(ApartmentDto.Currency)},
      new (){ Text= "邮编", Value= nameof(ApartmentDto.Address.ZipCode)},
      new (){ Text= "国家", Value= nameof(ApartmentDto.Address.Country)},
      new (){ Text= "城市", Value= nameof(ApartmentDto.Address.City)},
      new (){ Text= "街道", Value= nameof(ApartmentDto.Address.Street)}
    };

显示效果如下:

Image

Expected Behavior

No response

Steps To Reproduce

No response

Reproduction code


.NET version

.net core 8

a56209 avatar Jun 17 '25 14:06 a56209