-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New location for ChangePageSize (#318)
- Loading branch information
1 parent
dcef6dc
commit ce6feec
Showing
63 changed files
with
498 additions
and
193 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
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,61 +1,82 @@ | ||
@typeparam T | ||
@using GridBlazor.Resources | ||
@typeparam T | ||
|
||
@if (GridPager != null && GridPager.PageCount > 1) | ||
{ | ||
<nav class="grid-pager"> | ||
<ul class="pagination"> | ||
@if (GridPager.CurrentPage > 1) | ||
{ | ||
<li class="page-item"> | ||
<button type="button" class="page-link" @onclick="() => PagerButtonClicked(GridPager.CurrentPage - 1)">«</button> | ||
</li> | ||
} | ||
@if (GridPager.StartDisplayedPage > 1) | ||
{ | ||
<li class="page-item"> | ||
<button type="button" class="page-link" @onclick="() => PagerButtonClicked(1)">1</button> | ||
</li> | ||
@if (GridPager.StartDisplayedPage > 2) | ||
<div class="grid-pager-sizer"> | ||
@if (GridPager != null && GridPager.PageCount > 1) | ||
{ | ||
<nav class="grid-pager"> | ||
<ul class="pagination"> | ||
@if (GridPager.CurrentPage > 1) | ||
{ | ||
<li class="page-item"> | ||
<button type="button" class="page-link" @onclick="() => PagerButtonClicked(GridPager.StartDisplayedPage - 1)">...</button> | ||
<button type="button" class="page-link" @onclick="() => PagerButtonClicked(GridPager.CurrentPage - 1)">«</button> | ||
</li> | ||
} | ||
} | ||
@for (int i = GridPager.StartDisplayedPage; i <= GridPager.EndDisplayedPage; i++) | ||
{ | ||
if (i == GridPager.CurrentPage) | ||
@if (GridPager.StartDisplayedPage > 1) | ||
{ | ||
<li class="page-item active"> | ||
<button type="button" class="page-link">@i <span class="sr-only">(current)</span></button> | ||
<li class="page-item"> | ||
<button type="button" class="page-link" @onclick="() => PagerButtonClicked(1)">1</button> | ||
</li> | ||
@if (GridPager.StartDisplayedPage > 2) | ||
{ | ||
<li class="page-item"> | ||
<button type="button" class="page-link" @onclick="() => PagerButtonClicked(GridPager.StartDisplayedPage - 1)">...</button> | ||
</li> | ||
} | ||
} | ||
@for (int i = GridPager.StartDisplayedPage; i <= GridPager.EndDisplayedPage; i++) | ||
{ | ||
if (i == GridPager.CurrentPage) | ||
{ | ||
<li class="page-item active"> | ||
<button type="button" class="page-link">@i <span class="sr-only">(current)</span></button> | ||
</li> | ||
} | ||
else | ||
{ | ||
int j = i; | ||
<li class="page-item"> | ||
<button type="button" class="page-link" @onclick="async () => await PagerButtonClicked(j)">@j</button> | ||
</li> | ||
} | ||
} | ||
else | ||
@if (GridPager.EndDisplayedPage < GridPager.PageCount) | ||
{ | ||
int j = i; | ||
if (GridPager.EndDisplayedPage < GridPager.PageCount - 1) | ||
{ | ||
<li class="page-item"> | ||
<button type="button" class="page-link" @onclick="async () => await PagerButtonClicked(GridPager.EndDisplayedPage + 1)">...</button> | ||
</li> | ||
} | ||
<li class="page-item"> | ||
<button type="button" class="page-link" @onclick="async () => await PagerButtonClicked(j)">@j</button> | ||
<button type="button" class="page-link" @onclick="async () => await PagerButtonClicked(GridPager.PageCount)">@GridPager.PageCount</button> | ||
</li> | ||
} | ||
} | ||
@if (GridPager.EndDisplayedPage < GridPager.PageCount) | ||
{ | ||
if (GridPager.EndDisplayedPage < GridPager.PageCount - 1) | ||
@if (GridPager.CurrentPage < GridPager.PageCount) | ||
{ | ||
<li class="page-item"> | ||
<button type="button" class="page-link" @onclick="async () => await PagerButtonClicked(GridPager.EndDisplayedPage + 1)">...</button> | ||
<button type="button" class="page-link" @onclick="async () => await PagerButtonClicked(GridPager.CurrentPage + 1)">»</button> | ||
</li> | ||
} | ||
<li class="page-item"> | ||
<button type="button" class="page-link" @onclick="async () => await PagerButtonClicked(GridPager.PageCount)">@GridPager.PageCount</button> | ||
</li> | ||
} | ||
@if (GridPager.CurrentPage < GridPager.PageCount) | ||
{ | ||
<li class="page-item"> | ||
<button type="button" class="page-link" @onclick="async () => await PagerButtonClicked(GridPager.CurrentPage + 1)">»</button> | ||
</li> | ||
} | ||
</ul> | ||
</nav> | ||
} | ||
</ul> | ||
</nav> | ||
|
||
<div class="grid-goto-page form-group"> | ||
<label class="control-label"><b>@Strings.Goto</b></label> | ||
<div> | ||
<input class="form-control grid-goto-page-input" @bind="_currentPage" @onkeyup="GoToKeyup" @onblur="GoToBlur" @onclick:stopPropagation /> | ||
</div> | ||
</div> | ||
} | ||
|
||
@if (GridComponent.Grid.EnablePaging && GridComponent.Grid.Pager.ChangePageSize) | ||
{ | ||
<div class="grid-change-page-size form-group" data-change-page-size-url="@GridComponent.ChangePageSizeUrl"> | ||
<label class="control-label"><b>@Strings.Show</b></label> | ||
<div> | ||
<input @ref="GridComponent.PageSizeInput" class="form-control grid-change-page-size-input" @bind="GridComponent.PageSize" @onkeyup="GridComponent.InputPageSizeKeyup" @onblur="GridComponent.InputPageSizeBlur" @onclick:stopPropagation /> | ||
</div> | ||
<label class="control-label"><b>@Strings.Items</b></label> | ||
</div> | ||
} | ||
</div> |
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,20 +1,41 @@ | ||
using GridBlazor.Pagination; | ||
using Microsoft.AspNetCore.Components; | ||
using Microsoft.AspNetCore.Components.Web; | ||
using System.Threading.Tasks; | ||
|
||
namespace GridBlazor.Pages | ||
{ | ||
public partial class GridPagerComponent<T> | ||
{ | ||
private int _currentPage; | ||
|
||
[CascadingParameter (Name = "GridComponent")] | ||
private GridComponent<T> GridComponent { get; set; } | ||
|
||
[Parameter] | ||
public GridPager GridPager { get; set; } | ||
|
||
protected override void OnParametersSet() | ||
{ | ||
_currentPage = GridPager.CurrentPage; | ||
} | ||
|
||
protected async Task PagerButtonClicked(int page) | ||
{ | ||
await GridComponent.GoTo(page); | ||
} | ||
|
||
public async Task GoToKeyup(KeyboardEventArgs e) | ||
{ | ||
if (e.Key == "Enter") | ||
{ | ||
await GoToBlur(); | ||
} | ||
} | ||
|
||
public async Task GoToBlur() | ||
{ | ||
await GridComponent.GoTo(_currentPage); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
Oops, something went wrong.