In 18.3.0.35 the TressGrid will not show the loaded data. I have confirmed that the data is loaded in the OnInitializedAsync with a console write of the record count it always returns 57 records. On first load no data is shown, i.e. 'No records to display' , I can hit refresh in the browser it usually shows no data, but on rare occasions it will load the data, another refresh and it's gone.
<SfTreeGrid @ref="@TreeGrid"
TValue="AggregateStat"
IdMapping="Id"
ParentIdMapping="ParentId"
DataSource="TreeData"
AllowPaging="true"
AllowFiltering="true"
AllowReordering="false"
AllowResizing="true"
AllowSorting="true"
EnableCollapseAll="true"
AllowMultiSorting="true"
TreeColumnIndex="1">
<TreeGridEvents TValue="AggregateStat"
RowDataBound="OnRowDataBound"
ContextMenuOpen="OnContextMenuOpen"
ContextMenuItemClicked="OnContextMenuClick" />
<TreeGridFilterSettings Type="Syncfusion.Blazor.TreeGrid.FilterType.Excel" />
<TreeGridPageSettings PageSizes="true" />
<TreeGridColumns>
<TreeGridColumn Field="Id" HeaderText="Id" Visible="false" />
<TreeGridColumn Field="Key" HeaderText="Company" Width="400" />
<TreeGridColumn Field="Status" HeaderText="Status" Width="150" />
<TreeGridColumn Field="Count" HeaderText="# Submitted" Width="150" AllowFiltering="false" />
<TreeGridColumn Field="Total" HeaderText="Total" Width="150" Format="C2" AllowFiltering="false" />
<TreeGridColumn Field="Minimum" HeaderText="Minimum" Width="150" Format="C2" AllowFiltering="false"></TreeGridColumn>
<TreeGridColumn Field="Average" HeaderText="Average" Width="150" Format="C2" AllowFiltering="false"></TreeGridColumn>
<TreeGridColumn Field="Maximum" HeaderText="Maximum" Width="150" Format="C2" AllowFiltering="false"></TreeGridColumn>
</TreeGridColumns>
</SfTreeGrid>
--------------
public List<AggregateStat> TreeData { get; set; } = new List<AggregateStat>();
protected SfTreeGrid<AggregateStat> TreeGrid { get; set; }
protected override async Task OnInitializedAsync()
{
var authenticationStateProvider = await AuthenticationStateProvider.GetAuthenticationStateAsync();
UserId = authenticationStateProvider.User.Identity.Name.Split("@")[0];
ShowSpinner = true;
using (var context = ConnectDbFactory.CreateDbContext())
{
try
{
var clients = await context.Clients
.ToDictionaryAsync(r => r.ClientId);
var contacts = await context.ClientContacts
.ToDictionaryAsync(r => r.ClientContactId);
ClientsWithInvoices = await context.Invoices
.Where(r => contacts.Keys.Contains(r.ClientContactId))
.Select(r => r.ClientContactId)
.ToListAsync();
var stats = await context.ClientStats
.AsNoTracking()
.Select(r => new AggregateStat()
{
Id = r.ClientId,
Key = clients[r.ClientId].Organization,
Maximum = r.Maximum ?? 0,
Minimum = r.Minimum ?? 0,
Average = r.Average ?? 0,
Count = r.Invoices ?? 0,
LastInvoiced = r.LastInvoicedOn,
Total = r.Total ?? 0,
Status = string.Empty,
ParentId = null
}).ToListAsync();
var clientContactStats = await context.ClientContactStats
.AsNoTracking()
.Select(r => new AggregateStat()
{
Id = r.ClientContactId,
Key = $"{contacts[r.ClientContactId].ContactName}",
Maximum = r.Maximum ?? 0,
Minimum = r.Minimum ?? 0,
Average = r.Average ?? 0,
Count = r.Invoices ?? 0,
Total = r.Total ?? 0,
Status = r.Status,
LastInvoiced = r.LastInvoicedOn,
ParentId = contacts[r.ClientContactId].ClientId
}).ToListAsync();
TreeData = stats;
ShowSpinner = false;
Console.WriteLine($"TreeData Count {TreeData.Count}");
}
catch (Exception ex)
{
ShowSpinner = false;
Logger.LogError("Data Load Error", ex);
await MessageDialog.ShowModal("Data Load Error", "Unable to load data.");
}
}
}
It worked in 18.2.0.59