Fix data grid update

This commit is contained in:
2025-11-05 17:23:35 +09:00
parent a3c382ecb5
commit 652f35c5c4

View File

@ -26,9 +26,9 @@
</RadzenRow>
<RadzenRow>
<RadzenColumn SizeMD="12">
<RadzenDataGrid @ref="@dataGrid" TItem="Campaign" Data="@campaigns" RowExpand="@RowExpandAsync" RowCollapse="@RowCollapse" IsLoading="@(state != CampaignsPageState.Idle)" AllowFiltering="true" AllowPaging="true" ShowPagingSummary="true" PageSizeOptions=@(new int[] { 5, 10, 20, 30 }) AllowSorting="true" AllowColumnResize="true" ExpandMode="DataGridExpandMode.Single">
<RadzenDataGrid @ref="@campaignsDataGrid" TItem="Campaign" Data="@campaigns" RowExpand="@RowExpandAsync" RowCollapse="@RowCollapse" IsLoading="@(state != CampaignsPageState.Idle)" AllowFiltering="true" AllowPaging="true" ShowPagingSummary="true" PageSizeOptions=@(new int[] { 5, 10, 20, 30 }) AllowSorting="true" AllowColumnResize="true" ExpandMode="DataGridExpandMode.Single">
<Template Context="campaign">
<RadzenDataGrid Data="@campaign.Operations" AllowFiltering="true" AllowPaging="true" ShowPagingSummary="true" PageSizeOptions=@(new int[] { 5, 10, 20, 30 }) AllowSorting="true" AllowColumnResize="true">
<RadzenDataGrid @ref="@operationsDataGrid" Data="@campaign.Operations" AllowFiltering="true" AllowPaging="true" ShowPagingSummary="true" PageSizeOptions=@(new int[] { 5, 10, 20, 30 }) AllowSorting="true" AllowColumnResize="true">
<Columns>
<RadzenDataGridColumn Property="Id" Title="ID" SortOrder="SortOrder.Descending" Resizable="false" Width="100px" MaxWidth="100px" />
<RadzenDataGridColumn Property="Type" Title="Тип операции" />
@ -69,7 +69,8 @@
}
CampaignsPageState state;
RadzenDataGrid<Campaign> dataGrid;
RadzenDataGrid<Campaign> campaignsDataGrid;
RadzenDataGrid<Operation> operationsDataGrid;
IEnumerable<Campaign>? campaigns;
Campaign? expandedCampaign;
@ -144,11 +145,13 @@
if (targetCampaign != null)
{
targetCampaign.StartedAt = campaign.StartedAt;
campaignsDataGrid.Reload();
}
if (expandedCampaign != null && expandedCampaign.Id == campaign.Id)
{
dataGrid.CollapseAll();
campaignsDataGrid.CollapseAll();
}
});
}
@ -163,9 +166,11 @@
targetCampaign.Step = campaign.Step;
targetCampaign.Progress = campaign.Progress;
campaignsDataGrid.Reload();
if (expandedCampaign != null && expandedCampaign.Id == campaign.Id)
{
dataGrid.CollapseAll();
campaignsDataGrid.CollapseAll();
}
}
});
@ -186,6 +191,8 @@
if (targetOperation != null)
{
targetOperation.StartedAt = operation.StartedAt;
operationsDataGrid.Reload();
}
}
});
@ -201,6 +208,8 @@
if (targetOperation != null)
{
targetOperation.MessageGuid = operation.MessageGuid;
operationsDataGrid.Reload();
}
}
});
@ -217,6 +226,8 @@
{
targetOperation.EndedAt = operation.EndedAt;
targetOperation.FailureReason = operation.FailureReason;
operationsDataGrid.Reload();
}
}
});