forked from dotnet-architecture/eShopOnWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
preserve filters while paginating (dotnet-architecture#405)
- Loading branch information
Showing
1 changed file
with
39 additions
and
30 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 |
---|---|---|
@@ -1,34 +1,43 @@ | ||
@model PaginationInfoViewModel | ||
|
||
@{ | ||
var prevRouteData = Context.Request.Query.ToDictionary(x => x.Key, x => x.Value.ToString()); | ||
if (prevRouteData.ContainsKey("pageId")) | ||
prevRouteData.Remove("pageId"); | ||
prevRouteData.Add("pageId", (Model.ActualPage - 1).ToString()); | ||
var nextRouteData = Context.Request.Query.ToDictionary(x => x.Key, x => x.Value.ToString()); | ||
if (nextRouteData.ContainsKey("pageId")) | ||
nextRouteData.Remove("pageId"); | ||
nextRouteData.Add("pageId", (Model.ActualPage + 1).ToString()); | ||
} | ||
<div class="esh-pager"> | ||
<div class="container-fluid"> | ||
<article class="esh-pager-wrapper row"> | ||
<nav> | ||
<div class="col-md-2 col-xs-12"> | ||
<a class="esh-pager-item-left esh-pager-item--navigable esh-pager-item @Model.Previous" | ||
id="Previous" | ||
asp-route-pageid="@(Model.ActualPage - 1)" | ||
aria-label="Previous"> | ||
Previous | ||
</a> | ||
</div> | ||
<div class="col-md-8 col-xs-12"> | ||
<span class="esh-pager-item"> | ||
Showing @Model.ItemsPerPage of @Model.TotalItems products - Page @(Model.ActualPage + 1) - @Model.TotalPages | ||
</span> | ||
</div> | ||
<div class="col-md-2 col-xs-12"> | ||
<a class="esh-pager-item-right esh-pager-item--navigable esh-pager-item @Model.Next" | ||
id="Next" | ||
asp-route-pageid="@(Model.ActualPage + 1)" | ||
aria-label="Next"> | ||
Next | ||
</a> | ||
</div> | ||
</nav> | ||
</article> | ||
</div> | ||
<div class="container-fluid"> | ||
<article class="esh-pager-wrapper row"> | ||
<nav> | ||
<div class="col-md-2 col-xs-12"> | ||
<a class="esh-pager-item-left esh-pager-item--navigable esh-pager-item @Model.Previous" | ||
id="Previous" | ||
asp-all-route-data="prevRouteData" | ||
aria-label="Previous"> | ||
Previous | ||
</a> | ||
</div> | ||
|
||
<div class="col-md-8 col-xs-12"> | ||
<span class="esh-pager-item"> | ||
Showing @Model.ItemsPerPage of @Model.TotalItems products - Page @(Model.ActualPage + 1) - @Model.TotalPages | ||
</span> | ||
</div> | ||
|
||
<div class="col-md-2 col-xs-12"> | ||
<a class="esh-pager-item-right esh-pager-item--navigable esh-pager-item @Model.Next" | ||
id="Next" | ||
asp-all-route-data="nextRouteData" | ||
aria-label="Next"> | ||
Next | ||
</a> | ||
</div> | ||
</nav> | ||
</article> | ||
</div> | ||
</div> | ||
|