Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion blazorbootstrap/Components/Grid/Grid.razor
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,42 @@

@if (columns.Any())
{
@if (PlacePaginationBeforeGrid && AllowPaging && totalCount.HasValue && totalCount.Value > 0 && (!AutoHidePaging || (AutoHidePaging && totalCount.Value > pageSize)))
{
<div class="d-flex justify-content-between align-middle flex-wrap">
<Pagination ActivePageNumber="@gridCurrentState.PageIndex"
TotalPages="@totalPages"
PageChanged="OnPageChangedAsync"
FirstLinkIcon="IconName.ChevronDoubleLeft"
PreviousLinkIcon="IconName.ChevronLeft"
NextLinkIcon="IconName.ChevronRight"
LastLinkIcon="IconName.ChevronDoubleRight"
Alignment="Alignment.Start"
Class="mb-0" />

@if (PageSizeSelectorVisible && PageSizeSelectorItems is not null && PageSizeSelectorItems.Any())
{
<div>
<div class="d-flex justify-content-center align-middle">
<div>
<InputSelect class="form-select" role="button" TValue="int" Value="@pageSize" ValueExpression="() => pageSize" ValueChanged="async (value) => await OnPageSizeChangedAsync(value)">
@foreach (var i in PageSizeSelectorItems)
{
<option value="@i">@i</option>
}
</InputSelect>
</div>
<div class="bb-grid-pagination-text">@ItemsPerPageText</div>
</div>
</div>
}

<div class="bb-grid-pagination-text">
@paginationItemsText
</div>
</div>
}

var columnCount = columns.Where(c => c.IsVisible).Count();
if (AllowSelection) columnCount += 1;
if (AllowDetailView) columnCount += 1;
Expand Down Expand Up @@ -222,7 +258,7 @@
</table>
</div>

@if (AllowPaging && totalCount.HasValue && totalCount.Value > 0 && (!AutoHidePaging || (AutoHidePaging && totalCount.Value > pageSize)))
@if (AllowPaging && totalCount.HasValue && totalCount.Value > 0 && !PlacePaginationBeforeGrid && (!AutoHidePaging || (AutoHidePaging && totalCount.Value > pageSize)))
{
<div class="d-flex justify-content-between align-middle flex-wrap mt-2">
<Pagination ActivePageNumber="@gridCurrentState.PageIndex"
Expand Down
12 changes: 12 additions & 0 deletions blazorbootstrap/Components/Grid/Grid.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,18 @@ private void SetFilters(IEnumerable<FilterItem> filterItems)
[Parameter]
public bool AutoHidePaging { get; set; }

/// <summary>
/// Moves pagination from below the grid to above the grid.
/// <para>
/// Default value is <see langword="false"/>.
/// </para>
/// </summary>
[AddedVersion("")]
[DefaultValue(false)]
[Description("Moves pagination from below the grid to above the grid.")]
[Parameter]
public bool PlacePaginationBeforeGrid { get; set; }

/// <summary>
/// Gets or sets the content to be rendered within the component.
/// <para>
Expand Down