You can familiarize with the basic paging capabilities of r.a.d.
grid from this online example.
Pages can be changed by clicking on the page indicators in the footer.
The paging functionality can be enabled by setting the
AllowPaging property to
true.
The available settings are:
PageSize, PagerPosition (Top, Bottom or TopAndBottom) and
Mode (NextPrev or NumericPages).
If sorting is enabled as well, paging operation will automatically retain the sort order and sort direction.
Additionally, in order to display the grid pager regardless of the number of records returned
and the page size, you should set the
PagerStyle -> AlwaysVisible property of the
corresponding GridTableView to
true. Its default value is false.
Furthermore, you can set only the format of the text that will appear in the Pager using the
PagerTextFormat property. The default format is:
Change page: {4} | Displaying page {0} of {1}, items {2} to {3} of {5}.
The {0}, {1}, {2}, {3} and {4} parameters are mandatory when setting the property.
- {0} is used to display current page number.
- {1} is total number of pages.
- {2} will be replaced with the number of the first item in the current page.
- {3} will be set to the number of the last item in the current page.
- {4} indicates where pager buttons would appear.
- {5} corresponds to number of all items in the datasource.
The last grid in this demo shows how to use letters instead of numbers in the grid pager
and filter the records according to the letter the user chooses from the pager.
This is not built-in r.a.d.
grid feature, however it is quite easily attainable
with custom code. To integrate this type of paging mechanism for your grid instance,
you need to:
- Wire the ItemCreated event of the control and detect whether the currently bound
item is GridPagerItem
- Clear the Controls collection of the GridPagerItem PagerContentCell
- Generate LinkButtons with one and the same CommandName of your choice and
CommandArgument matching the Unicode code for the corresponding character
- Add these buttons to the Controls collection of the PagerContentCell
- Subscribe to the ItemCommand event of the grid and check whether
e.CommandName is the command name you specified for the LinkButtons
- Filter the records in the grid source in par with the e.CommandArgument value and
refresh the source content
- Rebind the grid calling its Rebind() method
Note: We chose the
PagerStyle -> AlwaysVisible = true option for the grid pager
to allow the page navigation regardless of the number of records returned.
More info regarding the built-in paging feature of r.a.d.
grid you can find in the
Paging help chapter:
Paging