[성현모] Grid Column 사이즈 적용
This commit is contained in:
@ -2,12 +2,22 @@
|
|||||||
|
|
||||||
@inject ContextMenuService ContextMenuService
|
@inject ContextMenuService ContextMenuService
|
||||||
|
|
||||||
<RadzenDataGrid Style="height:calc(100vh - 23rem); font-size: 20px;" TItem="TDataModel" Data="@DataList" AllowPaging PageSize="@PageSize"
|
<RadzenCard Style="height: 5.6rem; font-size: 1.5rem;" class="rz-mb-3 rz-p-0">
|
||||||
|
<RadzenStack Style="width:100%; height:2.7rem; background-color:var(--rz-primary-lighter);" class="rz-pl-3">
|
||||||
|
<RadzenLabel class="rz-p-1" Text="Summary">
|
||||||
|
</RadzenLabel>
|
||||||
|
</RadzenStack>
|
||||||
|
<RadzenStack Style="height: 2.9rem;" Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" JustifyContent="JustifyContent.Start">
|
||||||
|
<RadzenLabel class="rz-ml-10" Text="@SummaryTestResult"></RadzenLabel>
|
||||||
|
<RadzenLabel class="rz-ml-10" Text="@SummaryTestTime"></RadzenLabel>
|
||||||
|
</RadzenStack>
|
||||||
|
</RadzenCard>
|
||||||
|
|
||||||
|
<RadzenDataGrid Style="height:calc(100vh - 30rem);" TItem="TDataModel" Data="@DataList" AllowPaging PageSize="@PageSize"
|
||||||
AllowFiltering FilterMode="FilterMode.Advanced" CellRender="@CellRender" AllowColumnResize
|
AllowFiltering FilterMode="FilterMode.Advanced" CellRender="@CellRender" AllowColumnResize
|
||||||
SelectionMode="DataGridSelectionMode.Single" @bind-Value="@SelectedRow"
|
SelectionMode="DataGridSelectionMode.Single" @bind-Value="@SelectedRow"
|
||||||
CellContextMenu="@OnCellContextMenu" RowSelect="@SelectRow" RowDoubleClick="@OnRowDoublClick">
|
RowSelect="@SelectRow" RowDoubleClick="@OnRowDoublClick">
|
||||||
<Columns>
|
<Columns>
|
||||||
|
|
||||||
@if (VisibleRowNo == true)
|
@if (VisibleRowNo == true)
|
||||||
{
|
{
|
||||||
<RadzenDataGridColumn Title="No.">
|
<RadzenDataGridColumn Title="No.">
|
||||||
@ -21,15 +31,14 @@
|
|||||||
|
|
||||||
@foreach (var col in typeof(TDataModel).GetProperties())
|
@foreach (var col in typeof(TDataModel).GetProperties())
|
||||||
{
|
{
|
||||||
|
|
||||||
if(DisableColums?.Contains(col.Name.ToLower()) == true)
|
if(DisableColums?.Contains(col.Name.ToLower()) == true)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (col.Name.ToLower().Equals("testdate"))
|
if (col.Name.ToLower().Equals("testdate"))
|
||||||
{
|
{
|
||||||
<RadzenDataGridColumn Property="@col.Name" Title="@col.Name">
|
<RadzenDataGridColumn Property="@col.Name" Title="@col.Name" Width="10rem">
|
||||||
<Template>
|
<Template>
|
||||||
<span class="custom-rz-value rz-color-secondary">
|
<span class="rz-color-secondary">
|
||||||
@Convert.ToDateTime(col.GetValue(context)).ToString("yyyy-MM-dd")
|
@Convert.ToDateTime(col.GetValue(context)).ToString("yyyy-MM-dd")
|
||||||
</span>
|
</span>
|
||||||
</Template>
|
</Template>
|
||||||
@ -39,7 +48,7 @@
|
|||||||
{
|
{
|
||||||
<RadzenDataGridColumn Property="@col.Name" Title="@col.Name">
|
<RadzenDataGridColumn Property="@col.Name" Title="@col.Name">
|
||||||
<Template>
|
<Template>
|
||||||
<span class="custom-rz-value" style="color: lime;">
|
<span style="color: lime;">
|
||||||
@col.GetValue(context)
|
@col.GetValue(context)
|
||||||
</span>
|
</span>
|
||||||
</Template>
|
</Template>
|
||||||
@ -49,7 +58,27 @@
|
|||||||
{
|
{
|
||||||
<RadzenDataGridColumn Property="@col.Name" Title="@col.Name">
|
<RadzenDataGridColumn Property="@col.Name" Title="@col.Name">
|
||||||
<Template>
|
<Template>
|
||||||
<span class="custom-rz-value" style="color:red;">
|
<span style="color:red;">
|
||||||
|
@col.GetValue(context)
|
||||||
|
</span>
|
||||||
|
</Template>
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
}
|
||||||
|
else if (col.Name.ToLower().Equals("testdatetime"))
|
||||||
|
{
|
||||||
|
<RadzenDataGridColumn Property="@col.Name" Title="@col.Name" Width="20rem">
|
||||||
|
<Template>
|
||||||
|
<span>
|
||||||
|
@col.GetValue(context)
|
||||||
|
</span>
|
||||||
|
</Template>
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
}
|
||||||
|
else if (col.Name.ToLower().Contains("cntid") || col.Name.ToLower().Contains("reqid"))
|
||||||
|
{
|
||||||
|
<RadzenDataGridColumn Property="@col.Name" Title="@col.Name" Width="20rem">
|
||||||
|
<Template>
|
||||||
|
<span>
|
||||||
@col.GetValue(context)
|
@col.GetValue(context)
|
||||||
</span>
|
</span>
|
||||||
</Template>
|
</Template>
|
||||||
@ -59,7 +88,7 @@
|
|||||||
{
|
{
|
||||||
<RadzenDataGridColumn Property="@col.Name" Title="@col.Name">
|
<RadzenDataGridColumn Property="@col.Name" Title="@col.Name">
|
||||||
<Template>
|
<Template>
|
||||||
<span class="custom-rz-value">
|
<span>
|
||||||
@col.GetValue(context)
|
@col.GetValue(context)
|
||||||
</span>
|
</span>
|
||||||
</Template>
|
</Template>
|
||||||
@ -96,6 +125,28 @@
|
|||||||
|
|
||||||
private IList<TDataModel> SelectedRow;
|
private IList<TDataModel> SelectedRow;
|
||||||
|
|
||||||
|
private string SummaryTestResult = string.Empty;
|
||||||
|
private string SummaryTestTime = string.Empty;
|
||||||
|
|
||||||
|
protected override async Task OnParametersSetAsync()
|
||||||
|
{
|
||||||
|
if(typeof(TDataModel) == typeof(TestHistory))
|
||||||
|
{
|
||||||
|
var dataList = DataList.Cast<TestHistory>();
|
||||||
|
|
||||||
|
int ok = dataList.Count(x => x.TestResult.ToLower().Contains("ok"));
|
||||||
|
int ng = dataList.Count(x => !x.TestResult.ToLower().Contains("ok"));
|
||||||
|
double ratio = (double)(ok) / (double)(ok + ng) * 100.0;
|
||||||
|
|
||||||
|
double testTimeAvg = dataList.Average(x => Convert.ToInt32(x.Duration)) / 1000.0;
|
||||||
|
double testTimeMin = dataList.Min(x => Convert.ToInt32(x.Duration)) / 1000.0;
|
||||||
|
double testTimeMax = dataList.Max(x => Convert.ToInt32(x.Duration)) / 1000.0;
|
||||||
|
|
||||||
|
SummaryTestResult = $"Test Result: {ok + ng} (OK:{ok}/NG:{ng}) - Ratio:{ratio.ToString("F2")}%";
|
||||||
|
SummaryTestTime = $"Test Time: Average={testTimeAvg.ToString("F2")}sec Min={testTimeMin.ToString("F2")}sec Max={testTimeMax.ToString("F2")}sec";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void CellRender(DataGridCellRenderEventArgs<TDataModel> args)
|
private void CellRender(DataGridCellRenderEventArgs<TDataModel> args)
|
||||||
{
|
{
|
||||||
if (args.Column.Property == null)
|
if (args.Column.Property == null)
|
||||||
@ -154,28 +205,28 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OnCellContextMenu(DataGridCellMouseEventArgs<TDataModel> args)
|
// private async Task OnCellContextMenu(DataGridCellMouseEventArgs<TDataModel> args)
|
||||||
{
|
// {
|
||||||
SelectedRow = new List<TDataModel>() { args.Data };
|
// SelectedRow = new List<TDataModel>() { args.Data };
|
||||||
|
|
||||||
ContextMenuService.Open(args,
|
// ContextMenuService.Open(args,
|
||||||
new List<ContextMenuItem> {
|
// new List<ContextMenuItem> {
|
||||||
new ContextMenuItem(){ Text = "Overview", Value = 1, Icon = "home" },
|
// new ContextMenuItem(){ Text = "Overview", Value = 1, Icon = "home" },
|
||||||
new ContextMenuItem(){ Text = "Detail Overview", Value =2 , Icon = "assessment" },
|
// new ContextMenuItem(){ Text = "Detail Overview", Value =2 , Icon = "assessment" },
|
||||||
new ContextMenuItem(){ Text = "Test History", Value = 3, Icon = "description" },
|
// new ContextMenuItem(){ Text = "Test History", Value = 3, Icon = "description" },
|
||||||
new ContextMenuItem(){ Text = "Test Summary", Value = 4, Icon = "assignment_turned_in" },
|
// new ContextMenuItem(){ Text = "Test Summary", Value = 4, Icon = "assignment_turned_in" },
|
||||||
new ContextMenuItem(){ Text = "Detail Data", Value = 5, Icon = "list" },
|
// new ContextMenuItem(){ Text = "Detail Data", Value = 5, Icon = "list" },
|
||||||
new ContextMenuItem(){ Text = "Test-Error/Extended Search", Value = 6, Icon = "search" },
|
// new ContextMenuItem(){ Text = "Test-Error/Extended Search", Value = 6, Icon = "search" },
|
||||||
},
|
// },
|
||||||
(e) =>
|
// (e) =>
|
||||||
{
|
// {
|
||||||
ContextMenuService.Close();
|
// ContextMenuService.Close();
|
||||||
OnClickContextMenu.InvokeAsync();
|
// OnClickContextMenu.InvokeAsync();
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
|
|
||||||
await OnSelectRow.InvokeAsync(args.Data);
|
// await OnSelectRow.InvokeAsync(args.Data);
|
||||||
}
|
// }
|
||||||
|
|
||||||
private async Task SelectRow(TDataModel data)
|
private async Task SelectRow(TDataModel data)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
.custom-rz-value {
|
|
||||||
font-size: 1.5rem !important;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user