Behavior Settings
26 Apr 20182 minutes to read
Page Size List
The PageSizeList property of the pager control allows an option to have multiple options of page size values.By defining pageSizeList, a dropdown will render in a pager with given values along with the current pageSize as selected value in dropdown.
Selected value in a dropdown will be set to pageSize API and pager will refresh based on this new pageSize.
@{List<int> pageSizeList = new List<int>();
pageSizeList.Add(1);
pageSizeList.Add(2);
pageSizeList.Add(3);
}
<div class="control">
@Html.EJ().Pager("pager").TotalRecordsCount(20).PageSize(1).PageSizeList(pageSizeList).PageCount(3)
</div>
Page Size Message
The PageSizeMessage property allows to show a message along with the dropdown when pageSizeList API of pager control is defined. In the below sample, the PageSizeMessage of pager displays the current pageSize value of the pager control and will also be updated whenever the pageSize value is changed by selecting a value from the dropdown.
<div class="control">
@Html.EJ().Pager("pager").TotalRecordsCount(20).PageSize(1).PageCount(3).PageSizeMessage("PageSize value: 1").ClientSideEvents(eve => { eve.PageSizeSelected("pageSizeInfo");
</div>
<script>
function pageSizeInfo(e) {
var a = $("#pager").ejPager("instance");
a.option("pageSizeMessage", "PageSize value: " + e.pageSize);
}
</script>
Responsive
The pager control has responsive support such that control also fit with mobile resolutions. By enabling isResponsive API, you can make the pager control responsive. While resizing the browser window, the inner elements in the pager control will adjust automatically to equalize the size. By default, isResponsive API value is false.
@Html.EJ().Pager("pager").PageCount(3).PageSize(1).CurrentPage(1).IsResponsive(true).TotalRecordsCount(20)
Current Page
The CurrentPage value of the pager determines which page to be displayed currently. The default value of the currentPage API is 1
@Html.EJ().Pager("pager").PageSize(1).PageCount(3).CurrentPage(2).TotalRecordsCount(20)
Enable/Disable
You can enable or disable pager control by using Enabled property. Setting enabled API value as false will disable the user interaction with the pager control.
@Html.EJ().Pager("pager").PageSize(1).PageCount(3).Enabled(false).TotalRecordsCount(20)