Can't render the table when lazily loading it's datasource
See original GitHub issueSorry for not following the design rules report.
If the datasource is null or empty, and fetch data in the override method OnInitializedAsync. Then the table can’t render, exception "System.NullReferenceException: “Object reference not set to an instance of an object.” in /_Host .
<Table DataSource="data2">
<Column DataIndex="@context.id.ToString()" TData="int?" Sortable></Column>
<Column DataIndex="@context.Vetstation.title" TData="string" Sortable></Column>
<Column DataIndex="@context.Region.title" TData="string" Sortable></Column>
<Column DataIndex="@context.Farm.title" TData="string" Sortable></Column>
<Column DataIndex="@context.id_method_plan.ToString()" TData="int?" Sortable></Column>
<Column DataIndex="@context.Animal.title" TData="string" Sortable></Column>
<Column DataIndex="@context.date_enter.ToString()" TData="DateTime?" Format="dd-MM-yyyy" Sortable></Column>
<Column DataIndex="@context.date_add" TData="DateTime?" Format="dd-MM-yyyy" Sortable></Column>
<Column DataIndex="@context.amount.ToString()" TData="int?" Sortable></Column>
<Column DataIndex="@context.id_empl.ToString()" TData="int?" Sortable></Column>
</Table>
IEnumerable<PathdataDTO> data2;
@code
{
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
await InvokeAsync(StateHasChanged);
data2 = await pathdata.GetAll();
}
}
Further technical details
- AntDesign Nuget Package version 0.8.0
- The IDE: VS Community 2019
dotnet --info
Package SDK for.NET (global.json): Version: 5.0.101 Commit: d05174dc5a
Environment: OS Name: Windows OS Version: 6.1.7601 OS Platform: Windows RID: win7-x64 Base Path: C:\Program Files\dotnet\sdk\5.0.101\
Host (useful for support): Version: 5.0.1 Commit: b02e13abab
.NET SDKs installed: 5.0.101 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
@DJedai18 update to the latest nightly-build version(version 0.8.1,not 0.9.0), this issue is already fixed.
Please wait for the 0.8.1 release.