You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: components/pager/overview.md
+60-70Lines changed: 60 additions & 70 deletions
Original file line number
Diff line number
Diff line change
@@ -15,101 +15,91 @@ The **Pager** component will enable you to add paging for your data in a Blazor
15
15
To use Telerik Pager component for Blazor:
16
16
17
17
1. Add the `TelerikPager` tag
18
-
1. (optional) Populate it's `Total` parameter
19
-
1. (optional) Set it's `ButtonCount` parameter
20
-
1. (optional) Set the `PageChanged` parameter
21
-
1. (optional) Set `Page` or `@bind-Page` (one and two-way data binding)
22
-
1. (optional) Set a `PageSize`
18
+
1. The Pager component provides the UI for the user and the page index and an [event]({%slug pager-events%}) for the developer. It is up to the application to fetch the appropriate data based on that information.
23
19
24
-
>caption Basic setup of Pager component in your application
20
+
>caption Implement TelerikPager to your own component
25
21
26
22
````CSHTML
27
-
@*Basic Pager configuration.*@
23
+
@{
24
+
var pageData = Games.Skip((Page - 1) * PageSize).Take(PageSize).ToList();
Released on: @game.ReleaseDate.ToShortDateString()
34
+
</p>
35
+
</div>
36
+
</div>
37
+
}
41
38
}
42
-
````
43
-
44
-
>caption The result from the code snippet above
45
-
46
-

47
-
48
-
## Features
49
-
*`Class` - The CSS class that will be rendered on the main wrapping element of the Pager.
50
-
*`Total` - **int** - Represents the total count of items in the pager.
51
-
*`ButtonCount` - **int** - The number of pages to be visible. To take effect the `ButtonCount` must be **less** than the pages count (ButtonCount < Total / number of items on the page)
52
-
*`Page` and `@bind-Page` - **int** - Represents the current page of the pager. Those parameters are respectively for one and two-way data binding. If no `Page` or `@bind-Page` are provided they will default to the first page (1).
53
-
*`PageChanged` - Fires when a new page is selected (used in one-way data binding).
54
-
*`PageSize` - **int** - The number of items to be presented on a page.
55
-
56
-
## Examples
57
39
58
-
>caption Observe the behavior of the Pager with one-way data binding
59
-
60
-
````CSHTML
61
-
@*This example showcases the usage of Page and PageChanged in conjunction*@
public string Result { get; set; } = String.Empty;
43
+
public int PageSize { get; set; } = 3;
44
+
public int Page { get; set; } = 1;
45
+
46
+
public List<Game> Games { get; set; }
79
47
80
-
void PageChangedHandler(int page)
48
+
//In real-case scenario this model should be in a separate file
49
+
public class Game
50
+
{
51
+
public string GameName { get; set; }
52
+
public int GameId { get; set; }
53
+
public DateTime ReleaseDate { get; set; }
54
+
}
55
+
//Generate sample data
56
+
protected override void OnInitialized()
81
57
{
82
-
CurrentPage = page;
83
-
Result = $"Current page: {page}";
58
+
Games = new List<Game>();
59
+
for (int i = 0; i < 20; i++)
60
+
{
61
+
Games.Add(new Game()
62
+
{
63
+
GameName = $"Game {i}",
64
+
GameId = i + 1,
65
+
ReleaseDate = DateTime.Now.AddDays(i)
66
+
});
67
+
}
84
68
}
85
69
}
86
70
````
87
-
>caption The result from the code snippet above
88
71
89
-

72
+
## Features
73
+
*`Class` - The CSS class that will be rendered on the main wrapping element of the Pager.
74
+
*`Total` - ``int`` - Represents the total count of items in the pager.
75
+
*`ButtonCount` - ``int`` - The maximum number of pages to be visible. To take effect the `ButtonCount` must be **less** than the pages count (ButtonCount < Total / number of items on the page).
76
+
*`Page` and `@bind-Page` - ``int`` - Represents the current page of the pager. Those parameters are respectively for one and two-way data binding. If no `Page` or `@bind-Page` are provided they will default to the first page (1).
77
+
*`PageSize` - ``int`` - The number of items to be presented on a page.
78
+
79
+
## Examples
90
80
91
81
>caption Observe the behavior of the Pager with two-way data binding
92
82
93
83
````CSHTML
94
-
@*This example showcases the usage of Page and PageChanged in conjunction*@
84
+
@*This example showcases how the Pager reacts when the page is selected from an outside input.*@
0 commit comments