我无法正确渲染 Blazorise 数据网格。我已经在要点中包含了这些位,json 被加载,但没有在网格中呈现。这是要点:
https://gist.github.com/bbqchickenrobot/9af26063108beb4acb75e9a9dc5b4ae0
我无法正确渲染 Blazorise 数据网格。我已经在要点中包含了这些位,json 被加载,但没有在网格中呈现。这是要点:
https://gist.github.com/bbqchickenrobot/9af26063108beb4acb75e9a9dc5b4ae0
我测试了您的代码并完成了遗漏的代码,并且数据在 dataGrid 中正确显示。
问题是您的 json 数据在 camelCase 中,并且您在模型中使用 PascalCase。修改您的类模型,如下所示:
using System;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace Workflows.Blazo.Models
{
public class ApplicantViewModel
{
[Key]
[JsonPropertyName("id")]
public Guid Id { get; set; }
[JsonPropertyName("firstname")]
public string Firstname { get; set; }
[JsonPropertyName("middlename")]
public string Middlename { get; set; }
[JsonPropertyName("lastname")]
public string Lastname { get; set; }
public DateTime? Dob { get; set; }
[JsonPropertyName("emailAddress")]
public string EmailAddress { get; set; }
public string PhoneNumber { get; set; }
public string EmployeeNumber { get; set; }
[JsonPropertyName("offerDate")]
public DateTime? OfferDate { get; set; }
[JsonPropertyName("department")]
public string department { get; set; }
[JsonPropertyName("classificaiton")]
public string Classificaiton { get; set; }
[JsonPropertyName("createdDate")]
public DateTime? CreatedDate { get; set; }
[JsonPropertyName("modifiedDate")]
public DateTime? ModifiedDate { get; set; }
}
}
ReadData="@OnReadData"
我根据此处的考虑删除了,否则您必须对数据进行所有加载、过滤和排序。