SamovarGrid 1.0.1
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 SamovarGrid --version 1.0.1
NuGet\Install-Package SamovarGrid -Version 1.0.1
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="SamovarGrid" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SamovarGrid --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SamovarGrid, 1.0.1"
#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 SamovarGrid as a Cake Addin #addin nuget:?package=SamovarGrid&version=1.0.1 // Install SamovarGrid as a Cake Tool #tool nuget:?package=SamovarGrid&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SamovarGrid. DataGrid for Blazor.
Functions
- Sorting
- Paging
- Editing
- Deleting
- Cell template
- Row single selection
- Keyboard navigation
Prerequisites
- Bootstrap 4
- Open Iconic
.NET Core 3.0 download
Basic Sample
Bind Samovar Javascript and CSS files in _Host.cshtml
...
<link href="_content/SamovarGrid/samovar.grid.css" rel="stylesheet" />
...
<script src="_content/SamovarGrid/samovar.grid.js"></script>
...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>PacketServerTest</title>
<base href="~/" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link href="css/site.css" rel="stylesheet" />
<link href="_content/SamovarGrid/samovar.grid.css" rel="stylesheet" />
</head>
<body>
<app>
@(await Html.RenderComponentAsync<App>(RenderMode.ServerPrerendered))
</app>
<script src="_framework/blazor.server.js"></script>
<script src="_content/SamovarGrid/samovar.grid.js"></script>
</body>
</html>
@page "/"
@using Samovar
@using Samovar.Common
@using System.Linq
@using SamovarGridProServerTest.Data
@inject WeatherForecastService ForecastService
<h1>Table basic</h1>
<button class="btn btn-primary" @onclick="AddNewRow">add new row</button>
<button class="btn btn-primary" @onclick="CreateNewDataSet">create new data set</button>
<button class="btn btn-primary" @onclick="ClearDataSet">clear data set</button>
<SamovarGrid Data="@forecasts"
OrderFieldByDefault="@nameof(WeatherForecast.TemperatureC)"
OrderDesc="true"
Pageable="true"
PageSize="25"
Height="@gridHeight"
PagerSize="10"
OnRowSelected="RowSelectedHandler"
OnRowDeleteBegin="RowDeleteBeginHandler"
OnRowDeleteCommit="RowDeleteCommitHandler"
OnRowDeleteCancel="RowDeleteCancelHandler"
OnRowEditBegin="RowEditBeginHandler"
OnRowEditCommit="RowEditCommitHandler"
OnRowEditCancel="RowEditCancelHandler"
Headless="false"
SelectedRowClass="bg-warning">
<SamovarGridColumns>
<SamovarGridColumn Title="Date">
<CellShowTemplate>
@{
WeatherForecast data = context as WeatherForecast;
<div>@data.Date.ToShortDateString()</div>
}
</CellShowTemplate>
</SamovarGridColumn>
<SamovarGridColumn Title="Date2" Field="@nameof(WeatherForecast.Date)" />
<SamovarGridColumn Title="TemperatureC" Field="@nameof(WeatherForecast.TemperatureC)" />
<SamovarGridColumn Title="TemperatureF" Field="@nameof(WeatherForecast.TemperatureF)" />
<SamovarGridColumn Title="Summary" Field="@nameof(WeatherForecast.Summary)">
<CellEditTemplate>
@{
WeatherForecast data = context as WeatherForecast;
<input style="width:100%;" type="text" @bind="@data.Summary" @oninput="onInput" />
void onInput(ChangeEventArgs args)
{
}
}
</CellEditTemplate>
<CellShowTemplate>
@{
WeatherForecast data = context as WeatherForecast;
<div style="word-break:break-all;">@data.Summary</div>
}
</CellShowTemplate>
</SamovarGridColumn>
<SamovarGridColumn Title="Summary" Field="@nameof(WeatherForecast.Summary)" />
<SamovarGridCommandColumn Width="110px">
<SamovarGridCommand CommandName="edit" CommandType=Samovar.Common.GridRowCommandType.Edit />
<SamovarGridCommand CommandName="delete" CommandType=Samovar.Common.GridRowCommandType.Delete />
</SamovarGridCommandColumn>
</SamovarGridColumns>
</SamovarGrid>
<div class="form-group">
<label class="mr-2">Grid height</label>
<input @bind-value="@gridHeight" @bind-value:event="onchange" />
</div>
<h4>Datasize</h4>
<div>@forecasts.Count()</div>
<h4>Action</h4>
<div>@selectedAction</div>
<h4>Action row item</h4>
<div>@actionItem</div>
@code{
string gridHeight = "600px";
string selectedAction { set; get; }
string actionItem { set; get; }
List<WeatherForecast> forecasts = new List<WeatherForecast>();
IEnumerable<object> selectedForecasts;
protected override async Task OnInitializedAsync()
{
forecasts = (await ForecastService.GetForecastAsync(DateTime.Now)).ToList();
}
void RowSelectedHandler(GridRowEventArgs args)
{
actionItem = ((WeatherForecast)args.RowData).Summary;
selectedAction = "RowSelected";
}
void RowDeleteBeginHandler(GridRowEventArgs args)
{
actionItem = ((WeatherForecast)args.RowData).Summary;
selectedAction = "RowDeleteBegin";
}
void RowDeleteCancelHandler(GridRowEventArgs args)
{
actionItem = ((WeatherForecast)args.RowData).Summary;
selectedAction = "RowDeleteCancel";
}
void RowDeleteCommitHandler(GridRowEventArgs args)
{
actionItem = ((WeatherForecast)args.RowData).Summary;
this.forecasts.Remove((WeatherForecast)args.RowData);
selectedAction = "RowDeleteCommit";
}
void RowEditCommitHandler(GridRowEventArgs args)
{
WeatherForecast item = (WeatherForecast)args.RowData;
}
void RowEditBeginHandler(GridRowEventArgs args)
{
actionItem = ((WeatherForecast)args.RowData).Summary;
selectedAction = "RowEditBegin";
}
void RowEditCancelHandler(GridRowEventArgs args)
{
actionItem = ((WeatherForecast)args.RowData).Summary;
selectedAction = "RowEditCancel";
}
void AddNewRow()
{
forecasts.Add(new WeatherForecast
{
Date = new DateTime(2019, 1, 1),
Summary = "Summary",
TemperatureC = 33
});
}
async Task CreateNewDataSet()
{
forecasts = (await ForecastService.GetForecastAsync(DateTime.Now)).ToList();
}
void ClearDataSet()
{
forecasts.Clear();
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Microsoft.AspNetCore.Components (>= 3.0.0)
- Microsoft.AspNetCore.Components.Web (>= 3.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
8.0.0-beta.3 | 72 | 7/10/2024 | |
2.3.1 | 2,459 | 7/26/2020 | |
2.1.0 | 668 | 2/22/2020 | |
2.0.1 | 506 | 12/18/2019 | |
1.0.1 | 560 | 10/30/2019 |