This repository has been archived by the owner on Jul 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #204 from IvanJosipovic/dev
Added Localization (German) (thanks! @chrgraefe) Braking change: See readme for new initialization method. Added Column Visibility (thanks! @NilsPur) NuGet Update
- Loading branch information
Showing
26 changed files
with
1,278 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: nuget | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
time: "06:00" | ||
timezone: America/Vancouver | ||
open-pull-requests-limit: 10 | ||
ignore: | ||
- dependency-name: Microsoft.AspNetCore.* | ||
versions: | ||
- 5.x | ||
- dependency-name: System.Net.Http.Json | ||
versions: | ||
- 5.x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
src/BlazorTable.Sample.Shared/Pages/ToggleColumnVisibility.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
@page "/ToggleColumnVisibility" | ||
@inject HttpClient Http | ||
@using BlazorTable | ||
@using System.ComponentModel | ||
|
||
<h1>Toggle Column Visibility</h1> | ||
|
||
<button class="btn btn-primary mb-2" @onclick="@(_ => showSearchBar = !showSearchBar)">Toggle Search Bar</button> | ||
|
||
<Table TableItem="PersonData" Items="data" PageSize="15" ColumnReorder="true" ShowSearchBar="showSearchBar"> | ||
<Column Hideable="true" TableItem="PersonData" Title="Id" Field="@(x => x.id)" Sortable="true" Filterable="true" Width="10%" DefaultSortColumn="true" /> | ||
<Column Hideable="true" TableItem="PersonData" Title="Full Name" Field="@(x => x.full_name)" Sortable="true" Filterable="true" Width="20%" /> | ||
<Column Hideable="true" TableItem="PersonData" Title="Email" Field="@(x => x.email)" Sortable="true" Filterable="true" Width="20%"> | ||
<Template> | ||
<a href="mailto:@context.email">@context.email</a> | ||
</Template> | ||
</Column> | ||
<Column TableItem="PersonData" Title="Paid" Field="@(x => x.paid)" Sortable="true" Filterable="true" Width="10%"> | ||
<Template> | ||
@context.paid.ToString() | ||
</Template> | ||
</Column> | ||
<Column Hideable="true" TableItem="PersonData" Title="Price" Field="@(x => x.price)" Sortable="true" Filterable="true" Width="10%" Format="C" Align="Align.Right" /> | ||
<Column TableItem="PersonData" Title="Created Date" Field="@(x => x.created_date)" Sortable="true" Filterable="true" Width="10%"> | ||
<Template> | ||
@(context.created_date.HasValue ? context.created_date.Value.ToShortDateString() : string.Empty) | ||
</Template> | ||
</Column> | ||
<Column Hideable="true" TableItem="PersonData" Title="Enum" Field="@(x => x.cc_type)" Sortable="true" Filterable="true" Width="10%"> | ||
<Template> | ||
@context.cc_type | ||
</Template> | ||
</Column> | ||
<Pager ShowPageNumber="true" ShowTotalCount="true" /> | ||
</Table> | ||
|
||
@code | ||
{ | ||
[Inject] | ||
private HttpClient httpClient { get; set; } | ||
|
||
private PersonData[] data; | ||
|
||
private bool showSearchBar; | ||
|
||
protected override async Task OnInitializedAsync() | ||
{ | ||
data = await httpClient.GetFromJsonAsync<PersonData[]>("sample-data/MOCK_DATA.json"); | ||
} | ||
|
||
public class PersonData | ||
{ | ||
public int? id { get; set; } | ||
public string full_name { get; set; } | ||
public string email { get; set; } | ||
public bool? paid { get; set; } | ||
public decimal? price { get; set; } | ||
public CreditCard? cc_type { get; set; } | ||
public DateTime? created_date { get; set; } | ||
} | ||
|
||
public enum CreditCard | ||
{ | ||
none = 0, | ||
[Description("MasterCard")] | ||
MasterCard = 1, | ||
Visa = 2 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
@namespace BlazorTable | ||
@typeparam TableItem | ||
@inject Microsoft.Extensions.Localization.IStringLocalizer<BlazorTable.Components.Localization> Localization | ||
|
||
<CascadingValue Value="(IColumn<TableItem>)this.Column" Name="Column"> | ||
@ChildContent | ||
</CascadingValue> | ||
<br /> | ||
|
||
<div class="justify-content-md-center"> | ||
<button type="button" class="btn btn-danger btn-xs" role="button" @onclick="@((x) => Column.ToggleFilter())">Close</button> | ||
<button type="button" class="btn btn-secondary btn-xs" role="button" @onclick="@((x) => ClearFilter())">Clear</button> | ||
<button type="button" class="btn btn-primary btn-xs" role="button" @onclick="@((x) => ApplyFilter())">Apply</button> | ||
<button type="button" class="btn btn-danger btn-xs" role="button" @onclick="@((x) => Column.ToggleFilter())">@Localization["FilterManagerClose"]</button> | ||
<button type="button" class="btn btn-secondary btn-xs" role="button" @onclick="@((x) => ClearFilter())">@Localization["FilterManagerClear"]</button> | ||
<button type="button" class="btn btn-primary btn-xs" role="button" @onclick="@((x) => ApplyFilter())">@Localization["FilterManagerApply"]</button> | ||
</div> |
Oops, something went wrong.