Persilsoft.TemplatedList.Blazor
1.0.3
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Persilsoft.TemplatedList.Blazor --version 1.0.3
NuGet\Install-Package Persilsoft.TemplatedList.Blazor -Version 1.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Persilsoft.TemplatedList.Blazor" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Persilsoft.TemplatedList.Blazor --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Persilsoft.TemplatedList.Blazor, 1.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Persilsoft.TemplatedList.Blazor as a Cake Addin #addin nuget:?package=Persilsoft.TemplatedList.Blazor&version=1.0.3 // Install Persilsoft.TemplatedList.Blazor as a Cake Tool #tool nuget:?package=Persilsoft.TemplatedList.Blazor&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Templated List for Blazor
A simple implementation of Bootstrap table
Example
You can use it.
@page "/templatedlistdemo"
@using Persilsoft.TemplatedList.Blazor
<PageTitle>TemplatedList Demo</PageTitle>
<h1>TemplatedList Demo</h1>
<hr />
<TemplatedList TItem=GetOrdersDto
Loader="LoadOrders"
ListGroupClass="table-responsive">
<Loading>Loading data...</Loading>
<Empty>
<h2>No data available</h2>
</Empty>
<Item Context=Item>
<tr>
<td>
<h5 class="text-uppercase text-success">@Item.CreatedTime.ToLongDateString()</h5>
Pizzas:
<strong>@Item.PizzasCount</strong>
<br/>
Total:
<strong>@Item.GetFormattedTotalPrice()</strong>
</td>
<td>
Status:
<strong>@Item.Status</strong>
<div class="d-md-none">
@if (!Item.IsDelivered)
{
<br />
<div class="">
<a href="orderdetails/@Item.Id" class="btn btn-success">
Track order
</a>
</div>
}
</div>
</td>
<td>
<div class="d-none d-md-block">
@if (!Item.IsDelivered)
{
<div class="col text-end">
<a href="#" class="btn btn-success">
Track order
</a>
</div>
}
</div>
</td>
</tr>
</Item>
</TemplatedList>
@code {
public record class GetOrdersDto(int Id,
DateTime CreatedTime,
int PizzasCount,
decimal TotalPrice,
string Status,
bool IsDelivered)
{
public string GetFormattedTotalPrice() =>
$"$ {TotalPrice.ToString()}";
}
private async Task<IReadOnlyCollection<GetOrdersDto>> LoadOrders()
{
// The data could come from a Database
var list = new List<GetOrdersDto>
{
new GetOrdersDto(1, new DateTime(2023, 08, 03), 2, 55.50M, "Delivered", true),
new GetOrdersDto(1, new DateTime(2023, 09, 15), 1, 23.50M, "Delivered", true),
new GetOrdersDto(1, new DateTime(2023, 10, 16), 2, 57.50M, "Delivered", true),
new GetOrdersDto(1, DateTime.Now, 2, 66.50M, "On the way", false)
};
return await Task.FromResult(list.AsReadOnly());
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Microsoft.AspNetCore.Components.Web (>= 8.0.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.