Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #26 from IvanJosipovic/dev
Browse files Browse the repository at this point in the history
Updated BlazorStrap to 1.1.0-preview1-03
Added Column Align Parameter
  • Loading branch information
IvanJosipovic authored Nov 14, 2019
2 parents 9668511 + e7a2cad commit 671be7f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/BlazorTable/BlazorTable.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BlazorStrap" Version="1.1.0-preview1-02" />
<PackageReference Include="BlazorStrap" Version="1.1.0-preview1-03" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.1.0-preview2.19528.8" />
<PackageReference Include="Microsoft.AspNetCore.Components" Version="3.1.0-preview2.19528.8" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.1.0-preview2.19528.8" />
Expand Down
10 changes: 10 additions & 0 deletions src/BlazorTable/Components/Align.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace BlazorTable
{
public enum Align
{
None,
Left,
Center,
Right
}
}
3 changes: 3 additions & 0 deletions src/BlazorTable/Components/Column.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public string Title

[Parameter]
public Expression<Func<TableItem, object>> Field { get; set; }

[Parameter]
public Align Align { get; set; }

public Expression<Func<TableItem, bool>> Filter { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion src/BlazorTable/Components/Table.razor
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<tr>
@foreach (IColumn<TableItem> column in Columns)
{
<td>
<td style="@(column.Align == Align.Left ? "text-align: left;" : column.Align == Align.Center ? "text-align: center;" : column.Align == Align.Right ? "text-align: right;" : string.Empty)">
@if (IsEditMode && column.EditTemplate != null)
{
@column.EditTemplate(item)
Expand Down
5 changes: 5 additions & 0 deletions src/BlazorTable/Interfaces/IColumn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,10 @@ public interface IColumn<TableItem>
/// Direction of sorting
/// </summary>
bool SortDescending { get; set; }

/// <summary>
/// Horizontal alignment
/// </summary>
Align Align { get; set; }
}
}

0 comments on commit 671be7f

Please sign in to comment.