[성현모] Grid Column 사이즈 적용
This commit is contained in:
@ -2,12 +2,22 @@
|
||||
|
||||
@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
|
||||
SelectionMode="DataGridSelectionMode.Single" @bind-Value="@SelectedRow"
|
||||
CellContextMenu="@OnCellContextMenu" RowSelect="@SelectRow" RowDoubleClick="@OnRowDoublClick">
|
||||
RowSelect="@SelectRow" RowDoubleClick="@OnRowDoublClick">
|
||||
<Columns>
|
||||
|
||||
@if (VisibleRowNo == true)
|
||||
{
|
||||
<RadzenDataGridColumn Title="No.">
|
||||
@ -21,15 +31,14 @@
|
||||
|
||||
@foreach (var col in typeof(TDataModel).GetProperties())
|
||||
{
|
||||
|
||||
if(DisableColums?.Contains(col.Name.ToLower()) == true)
|
||||
continue;
|
||||
|
||||
|
||||
if (col.Name.ToLower().Equals("testdate"))
|
||||
{
|
||||
<RadzenDataGridColumn Property="@col.Name" Title="@col.Name">
|
||||
{
|
||||
<RadzenDataGridColumn Property="@col.Name" Title="@col.Name" Width="10rem">
|
||||
<Template>
|
||||
<span class="custom-rz-value rz-color-secondary">
|
||||
<span class="rz-color-secondary">
|
||||
@Convert.ToDateTime(col.GetValue(context)).ToString("yyyy-MM-dd")
|
||||
</span>
|
||||
</Template>
|
||||
@ -39,7 +48,7 @@
|
||||
{
|
||||
<RadzenDataGridColumn Property="@col.Name" Title="@col.Name">
|
||||
<Template>
|
||||
<span class="custom-rz-value" style="color: lime;">
|
||||
<span style="color: lime;">
|
||||
@col.GetValue(context)
|
||||
</span>
|
||||
</Template>
|
||||
@ -49,7 +58,27 @@
|
||||
{
|
||||
<RadzenDataGridColumn Property="@col.Name" Title="@col.Name">
|
||||
<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)
|
||||
</span>
|
||||
</Template>
|
||||
@ -59,7 +88,7 @@
|
||||
{
|
||||
<RadzenDataGridColumn Property="@col.Name" Title="@col.Name">
|
||||
<Template>
|
||||
<span class="custom-rz-value">
|
||||
<span>
|
||||
@col.GetValue(context)
|
||||
</span>
|
||||
</Template>
|
||||
@ -96,6 +125,28 @@
|
||||
|
||||
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)
|
||||
{
|
||||
if (args.Column.Property == null)
|
||||
@ -154,28 +205,28 @@
|
||||
}
|
||||
}
|
||||
|
||||
private async Task OnCellContextMenu(DataGridCellMouseEventArgs<TDataModel> args)
|
||||
{
|
||||
SelectedRow = new List<TDataModel>() { args.Data };
|
||||
// private async Task OnCellContextMenu(DataGridCellMouseEventArgs<TDataModel> args)
|
||||
// {
|
||||
// SelectedRow = new List<TDataModel>() { args.Data };
|
||||
|
||||
ContextMenuService.Open(args,
|
||||
new List<ContextMenuItem> {
|
||||
new ContextMenuItem(){ Text = "Overview", Value = 1, Icon = "home" },
|
||||
new ContextMenuItem(){ Text = "Detail Overview", Value =2 , Icon = "assessment" },
|
||||
new ContextMenuItem(){ Text = "Test History", Value = 3, Icon = "description" },
|
||||
new ContextMenuItem(){ Text = "Test Summary", Value = 4, Icon = "assignment_turned_in" },
|
||||
new ContextMenuItem(){ Text = "Detail Data", Value = 5, Icon = "list" },
|
||||
new ContextMenuItem(){ Text = "Test-Error/Extended Search", Value = 6, Icon = "search" },
|
||||
},
|
||||
(e) =>
|
||||
{
|
||||
ContextMenuService.Close();
|
||||
OnClickContextMenu.InvokeAsync();
|
||||
}
|
||||
);
|
||||
// ContextMenuService.Open(args,
|
||||
// new List<ContextMenuItem> {
|
||||
// new ContextMenuItem(){ Text = "Overview", Value = 1, Icon = "home" },
|
||||
// new ContextMenuItem(){ Text = "Detail Overview", Value =2 , Icon = "assessment" },
|
||||
// new ContextMenuItem(){ Text = "Test History", Value = 3, Icon = "description" },
|
||||
// new ContextMenuItem(){ Text = "Test Summary", Value = 4, Icon = "assignment_turned_in" },
|
||||
// new ContextMenuItem(){ Text = "Detail Data", Value = 5, Icon = "list" },
|
||||
// new ContextMenuItem(){ Text = "Test-Error/Extended Search", Value = 6, Icon = "search" },
|
||||
// },
|
||||
// (e) =>
|
||||
// {
|
||||
// ContextMenuService.Close();
|
||||
// OnClickContextMenu.InvokeAsync();
|
||||
// }
|
||||
// );
|
||||
|
||||
await OnSelectRow.InvokeAsync(args.Data);
|
||||
}
|
||||
// await OnSelectRow.InvokeAsync(args.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