Blazorise grid :thumbs_up:

master
pasquizzat 3 years ago
parent 8a2942f664
commit 6ca95dfd64

@ -6,4 +6,10 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Blazorise.Bootstrap" Version="1.1.2" />
<PackageReference Include="Blazorise.DataGrid" Version="1.1.2" />
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="1.1.2" />
</ItemGroup>
</Project> </Project>

@ -1,34 +1,25 @@
@page "/list" @using CetteAppliVaMarcher.Models
@page "/list"
<h3>List</h3> <h3>List</h3>
@if (items != null) <DataGrid TItem="Item"
{ Data="@items"
<table class="table"> PageSize="int.MaxValue"
<thead> Responsive>
<tr> <DataGridColumn TItem="Item" Field="@nameof(Item.Id)" Caption="#" />
<th>Id</th> <DataGridColumn TItem="Item" Field="@nameof(Item.DisplayName)" Caption="Display name" />
<th>Display Name</th> <DataGridColumn TItem="Item" Field="@nameof(Item.StackSize)" Caption="Stack size" />
<th>Stack Size</th> <DataGridColumn TItem="Item" Field="@nameof(Item.MaxDurability)" Caption="Maximum durability" />
<th>Maximum Durability</th> <DataGridColumn TItem="Item" Field="@nameof(Item.EnchantCategories)" Caption="Enchant categories">
<th>Enchant Categories</th> <DisplayTemplate>
<th>Repair With</th> @(string.Join(", ", ((Item)context).EnchantCategories))
<th>Created Date</th> </DisplayTemplate>
</tr> </DataGridColumn>
</thead> <DataGridColumn TItem="Item" Field="@nameof(Item.RepairWith)" Caption="Repair with">
<tbody> <DisplayTemplate>
@foreach (var item in items) @(string.Join(", ", ((Item)context).RepairWith))
{ </DisplayTemplate>
<tr> </DataGridColumn>
<td>@item.Id</td> <DataGridColumn TItem="Item" Field="@nameof(Item.CreatedDate)" Caption="Created date" DisplayFormat="{0:d}" DisplayFormatProvider="@System.Globalization.CultureInfo.GetCultureInfo("fr-FR")" />
<td>@item.DisplayName</td> </DataGrid>
<td>@item.StackSize</td>
<td>@item.MaxDurability</td>
<td>@(string.Join(", ", item.EnchantCategories))</td>
<td>@(string.Join(", ", item.RepairWith))</td>
<td>@item.CreatedDate.ToShortDateString()</td>
</tr>
}
</tbody>
</table>
}

@ -28,5 +28,10 @@
</div> </div>
<script src="_framework/blazor.server.js"></script> <script src="_framework/blazor.server.js"></script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css">
<link href="_content/Blazorise/blazorise.css" rel="stylesheet" />
<link href="_content/Blazorise.Bootstrap/blazorise.bootstrap.css" rel="stylesheet" />
</body> </body>
</html> </html>

@ -1,3 +1,6 @@
using Blazorise;
using Blazorise.Bootstrap;
using Blazorise.Icons.FontAwesome;
using CetteAppliVaMarcher.Data; using CetteAppliVaMarcher.Data;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.Web;
@ -9,6 +12,11 @@ builder.Services.AddServerSideBlazor();
builder.Services.AddSingleton<WeatherForecastService>(); builder.Services.AddSingleton<WeatherForecastService>();
builder.Services.AddHttpClient(); builder.Services.AddHttpClient();
builder.Services
.AddBlazorise()
.AddBootstrapProviders()
.AddFontAwesomeIcons();
var app = builder.Build(); var app = builder.Build();
// Configure the HTTP request pipeline. // Configure the HTTP request pipeline.

@ -8,3 +8,4 @@
@using Microsoft.JSInterop @using Microsoft.JSInterop
@using CetteAppliVaMarcher @using CetteAppliVaMarcher
@using CetteAppliVaMarcher.Shared @using CetteAppliVaMarcher.Shared
@using Blazorise.DataGrid
Loading…
Cancel
Save