Skip to content

Commit 5378286

Browse files
README.md updated
1 parent 44b9c86 commit 5378286

File tree

2 files changed

+75
-2
lines changed

2 files changed

+75
-2
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
language: csharp
2+
solution: P.Pager.sln

README.md

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# P.Pager
1+
# ![alt text](https://raw.githubusercontent.com/PuffinWeb/P.Pager/master/icon.png =25x25)P.Pager
22

33
## Build Status
44

@@ -53,8 +53,76 @@ public class HomeController : Controller
5353

5454
## PagerOptions
5555
Default options for rendering pagination.
56+
#### Properties
57+
|Option|Type|Summary|Default|
58+
|-----------|-----------|-------|---|
59+
|DisplayFirstPage|[PagerDisplayMode](#pagerdisplaymode)|If set to Always, render a hyperlink to the first page in the list. If set to IfNeeded, render the hyperlink only when the first page isn't visible in the paging control.|IfNeeded|
60+
|DisplayLastPage|[PagerDisplayMode](#pagerdisplaymode)|If set to Always, render a hyperlink to the last page in the list. If set to IfNeeded, render the hyperlink only when the last page isn't visible in the paging control.|IfNeeded|
61+
|DisplayPreviousPage|[PagerDisplayMode](#pagerdisplaymode)|If set to Always, render a hyperlink to the previous page of the list. If set to IfNeeded, render the hyperlink only when there is a previous page in the list.|IfNeeded|
62+
|DisplayNextPage|[PagerDisplayMode](#pagerdisplaymode)|If set to Always, render a hyperlink to the next page of the list. If set to IfNeeded, render the hyperlink only when there is a next page in the list.|IfNeeded|
63+
|PagesToDisplay|int?|How many page numbers to display in pagination, by default it is 5.|5|
64+
|HasIndividualPages|bool|Display pages numbers. Refer [PagesToDisplay]()|true|
65+
|TextToIndividualPages|string|A formatted text to show to show inside the hyperlink. Use {0} to refer page number, by default it is set to {0}|{0}|
66+
|TextForDelimiter|string|This will appear between each page number. If null or white space, no delimeter will display.|null|
67+
|HasEllipses|bool|Adds an ellipe when all page numbers are not displaying, by default it is true.|true|
68+
|EllipsesFormat|string|A formatted text shows when all pages are not displaying, by default it is …|…|
69+
|TextToFirstPage|string|A formatted text to show for firstpage link, by default it is set to <<.|<<|
70+
|TextToPreviousPage|string|A formatted text to show for previous page link, by default it is set to <.|<|
71+
|TextToNextPage|string|A formatted text to show for next page link, by default it is set to >.|>|
72+
|TextToLastPage|string|A formatted text to show for last page link, by default it is set to >>.|>>|
73+
|ClassToPagerContainer|string|Css class to append to <div> element in the paging content, by default it is set to pager container.|container|
74+
|ClassToUl|string|Css class to append to <ul> element in the paging content, by default it is set to pagination.|pagination|
75+
|ClassToLi|string|Css class to append to <li> element in the paging content, by default it is set to page-item.|page-item|
76+
|PageClass|string|Css class to append to <a>/<span> element in the paging content, by default it is set to page-link.|page-link|
77+
|ClassToActiveLi|string|Css class to append to <li> element if active in the paging content, by default it is set to active.|active|
78+
|HasPagerText|bool|Displaying current page number and total number of pages in pager, by default it is set to false.|false|
79+
|PagerTextFormat|string|Text format will display if HasPagerText is true. Use {0} to refer the current page and {0} to refer total number of pages, by default it is set to Page {0} of {1}.|Page {0} of {1}.|
80+
|HasEntriesText|bool|Displaying start item, last item and total entries in pager, by default it is set to false.|false|
81+
|EntriesTextFormat|string|Text format will display if HasEntriesText is true. {0} refers first entry on page, {1} refers last item on page and {2} refers total number of entries, by default it is set to Showing {0} to {1} of {2} entries.|Showing {0} to {1} of {2} entries.|
82+
||||
83+
84+
### PagerDisplayMode
85+
A tri-state enum that controls the visibility of portions of the PagerList paging control.
86+
```csharp
87+
public enum PagerDisplayMode
88+
```
89+
|Fields|Description|
90+
|---|----|
91+
|Always|Always render.|
92+
|Never|Never render.|
93+
|IfNeeded|Only render when there is data that makes sense to show (context sensitive).|
94+
|||
95+
96+
### How to use PagerOptions?
97+
1. Shows custom page numbers, let say 10 pages.
98+
```csharp
99+
@Html.Pager((IPager)Model, page => Url.Action("Index", new { page }), new PagerOptions { PagesToDisplay = 10 })
100+
```
101+
![alt text](https://raw.githubusercontent.com/PuffinWeb/P.Pager/master/img/7.custompagenumbers.PNG)
56102

103+
2. With Custom Page Text.
104+
```csharp
105+
@Html.Pager((IPager)Model, page => Url.Action("Index", new { page }), new PagerOptions { TextToIndividualPages = "Page-{0}" })
106+
```
107+
![alt text](https://raw.githubusercontent.com/PuffinWeb/P.Pager/master/img/8.CustomPageText.PNG)
57108

109+
3. Custom Wording. (<i>Can use for translation also.</i>)
110+
```csharp
111+
@Html.Pager((IPager)Model, page => Url.Action("Index", new { page }), new PagerOptions { TextToPreviousPage = "Previous Page", TextToNextPage = "Next Page", TextToFirstPage = "First Page", TextToLastPage = "Last Page" })
112+
```
113+
![alt text](https://raw.githubusercontent.com/PuffinWeb/P.Pager/master/img/9.CustomWording.PNG)
114+
115+
4. Custom options.
116+
```csharp
117+
@Html.Pager((IPager)Model, page => Url.Action("Index", new { page }), new PagerOptions { TextToPreviousPage = "last-page", TextToNextPage = "next-page", TextToFirstPage = "first-page", TextToLastPage = "last-page", ClassToUl = "list-inline", ClassToLi = "list-inline-item", PageClass = "nopageclass", ClassToActiveLi = "niloclass", TextForDelimiter = " | " })
118+
```
119+
![alt text](https://raw.githubusercontent.com/PuffinWeb/P.Pager/master/img/10.CustomOptions.PNG)
120+
121+
5. Custom Icon Options (Fontawsome)
122+
```csharp
123+
@Html.Pager((IPager)Model, page => Url.Action("Index", new { page }), new PagerOptions { TextToPreviousPage = "<i class='fas fa-step-backward'></i>", TextToNextPage = "<i class='fas fa-step-forward'></i>", TextToFirstPage = "<i class='fas fa-fast-backward'></i>", TextToLastPage = "<i class='fas fa-fast-forward'></i>" })
124+
```
125+
![alt text](https://raw.githubusercontent.com/PuffinWeb/P.Pager/master/img/11.Using%20Icons.PNG)
58126
## PrePagerOptions
59127
1. Minimal Pager
60128
```csharp
@@ -82,10 +150,13 @@ Default options for rendering pagination.
82150
//Shows Previous and Next page always with default, 5 pages.
83151
@Html.Pager((IPager)Model, page => Url.Action("Index", new { page }), PrePagerOptions.ClassicPager)
84152
```
85-
6. Classic Pager <small>(Classic Pager with First and Last links, but sometimes they are disabled)</small>
153+
![alt text](https://raw.githubusercontent.com/PuffinWeb/P.Pager/master/img/5.classic.PNG)
154+
155+
6. Classic Pager with First and Last<small>(Classic Pager with First and Last links, but sometimes they are disabled)</small>
86156
```csharp
87157
//Shows Last, First, Previous and Next page always with default, 5 pages.
88158
@Html.Pager((IPager)Model, page => Url.Action("Index", new { page }), PrePagerOptions.ClassicPagerWithFirstAndLastPages)
89159
```
160+
![alt text](https://raw.githubusercontent.com/PuffinWeb/P.Pager/master/img/6.classiclastfirst.PNG)
90161
## License
91162
Licensed under the [MIT License](https://github.com/PuffinWeb/P.Pager/blob/master/LICENSE).

0 commit comments

Comments
 (0)