Class SfDataPager
Provides paging functionality for SfDataGrid that displays records in a paged view.
Inheritance
Namespace: Syncfusion.SfDataGrid.DataPager
Assembly: Syncfusion.SfDataGrid.Android.dll
Syntax
public class SfDataPager : FrameLayout
Constructors
SfDataPager(Context)
Initializes a new instance of the SfDataPager class.
Declaration
public SfDataPager(Context context)
Parameters
Type | Name | Description |
---|---|---|
Android.Content.Context | context | The Android.Content.Context. |
SfDataPager(Context, IAttributeSet)
Initializes a new instance of the SfDataPager class.
Declaration
public SfDataPager(Context context, IAttributeSet attributeSet)
Parameters
Type | Name | Description |
---|---|---|
Android.Content.Context | context | The Android.Content.Context. |
Android.Util.IAttributeSet | attributeSet | The Android.Util.IAttributeSet. |
SfDataPager(Context, IAttributeSet, Int32)
Initializes a new instance of the SfDataPager class.
Declaration
public SfDataPager(Context context, IAttributeSet attributeSet, int definedAttribute)
Parameters
Type | Name | Description |
---|---|---|
Android.Content.Context | context | The Android.Content.Context. |
Android.Util.IAttributeSet | attributeSet | The Android.Util.IAttributeSet. |
System.Int32 | definedAttribute | defined attributes |
SfDataPager(Context, IAttributeSet, Int32, Int32)
Initializes a new instance of the SfDataPager class.
Declaration
public SfDataPager(Context context, IAttributeSet attributeSet, int definedAttribute, int definedStyle)
Parameters
Type | Name | Description |
---|---|---|
Android.Content.Context | context | The Android.Content.Context. |
Android.Util.IAttributeSet | attributeSet | The Android.Util.IAttributeSet |
System.Int32 | definedAttribute | The value indicating the defined attribute. |
System.Int32 | definedStyle | The value indicating the defined style. |
SfDataPager(IntPtr, JniHandleOwnership)
Initializes a new instance of the SfDataPager class.
Declaration
protected SfDataPager(IntPtr javaReference, JniHandleOwnership transfer)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | javaReference | The refrence to System.IntPtr |
Android.Runtime.JniHandleOwnership | transfer | The refrence to Android.Runtime.JniHandleOwnership |
Properties
AppearanceManager
Gets or sets the appearance manager, SfDataPager enables the user to customize the appearance of the pager by writing a Style class overriding from AppearanceManager and assigning the customized class to this property.
Declaration
public AppearanceManager AppearanceManager { get; set; }
Property Value
Type | Description |
---|---|
AppearanceManager | The AppearanceManager of SfDataPager. |
Examples
sfDataPager.AppearanceManager = new CustomAppearance();
//CustomAppearance.cs
public class CustomAppearance : AppearanceManager
{
}
See Also
AutoEllipsisMode
Gets or sets AutoEllipsisMode, which indicates the possible ellipsis mode for the numeric button in the scrollable panel of the SfDataPager. By default, all the numeric buttons in the page will be in view. However, the user can set auto ellipsis mode by using AutoEllipsisMode property.
Declaration
public AutoEllipsisMode AutoEllipsisMode { get; set; }
Property Value
Type | Description |
---|---|
AutoEllipsisMode | The AutoEllipsisMode for the numeric button in the SfDataPager. |
Examples
sfPager.AutoEllipsisMode = AutoEllipsisMode.After;
AutoEllipsisText
Gets or sets the text for the numeric button in auto ellipsis mode. By default, all the numeric buttons in the page will be in view. However, the user can set auto ellipsis mode by using AutoEllipsisMode property. SfDataPager allows the user to customize the text to be displayed in the auto ellipsis mode by using this property.
Declaration
public string AutoEllipsisText { get; set; }
Property Value
Type | Description |
---|---|
System.String | The text for the numeric button in auto ellipsis button. The default value is "...". |
Examples
sfPager.AutoEllipsisMode = AutoEllipsisMode.After;
sfPager.AutoEllipsisText = "~~~";
DisplayMode
Gets or sets the page display mode for the SfDataPager. The user can customize the buttons to be displayed in the pager, by using this property. By default all the buttons (first, last, next, previous and numeric buttons) will be in view.
Declaration
public PagerDisplayMode DisplayMode { get; set; }
Property Value
Type | Description |
---|---|
PagerDisplayMode | The PagerDisplayMode of SfDataPager. |
Examples
sfPager.DisplayMode = PagerDisplayMode.FirstLastNumeric;
EnableGridPaging
Gets or sets a value indicating whether to create source from Syncfusion.SfDataGrid.DataPager.GridPagedCollectionViewWrapper or PagedCollectionView.
Declaration
public bool EnableGridPaging { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True, if the source is created from Syncfusion.SfDataGrid.DataPager.GridPagedCollectionViewWrapper, otherwise false. The default value is true. |
Remarks
The items can be loaded in the Datapager by two ways: normal paging and on demand paging. In normal paging, all the items are loaded initially when the grid is loaded. In on demand paging, the items are loaded to the grid only when navigating to the page i.e. items are loaded dynamically on demand.
When Normal paging is used, the source is created from Syncfusion.SfDataGrid.DataPager.GridPagedCollectionViewWrapper, since it has to load all the items to the grid. When on demand paging is used, the source is created from PagedCollectionView, since it has to load the items to the grid for the current page only.
When EnableGridPaging is set as true, it is necessary to hook the OnDemandLoading event to load the items dynamically to the grid and set UseOnDemandPaging to true.
Examples
sfPager.EnableGridPaging = false;
sfPager.UseOnDemandPaging = true;
sfPager.OnDemandLoading += sfPager_OnDemandLoading;
private void OnDemandPageLoading(object sender, OnDemandLoadingEventArgs args)
{
sfDataPager.LoadDynamicItems(args.StartIndex, source.Skip(args.StartIndex).Take(args.PageSize));
}
See Also
NumericButtonBackground
Gets or sets a Color, which is set as background color of the selected NumericButtons and Navigation Buttons.
Declaration
public Color NumericButtonBackground { get; set; }
Property Value
Type |
---|
Android.Graphics.Color |
NumericButtonCount
Gets or sets the number of buttons to be displayed in the view in SfDataPager.
Declaration
public int NumericButtonCount { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of buttons to be displayed in the view in SfDataPager. |
Remarks
if NumericButtonCount is greater than View size, then number of button need to be displayed is calculated based on view size.
Examples
sfPager.Source = viewModel.Info;
sfGrid.ItemsSource = sfPager.PagedSource;
sfPager.PageSize = 15;
sfPager.NumericButtonCount = 4;
Orientation
Gets or sets the scroll orientation of the DataPager. By default, SfDataPager will scroll horizontally, the user can customize the pager to be scrolled vertically or in both horizontal and vertical directions by using this property.
Declaration
public ScrollOrientation Orientation { get; set; }
Property Value
Type | Description |
---|---|
ScrollOrientation | The ScrollOrientation of the SfDataPager. The default value is Horizontal. |
Examples
sfPager.Orientation = ScrollOrientation.Both;
PageCount
Gets or sets the page count, which returns the total number of pages in SfDataPager.
Declaration
public int PageCount { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The total number of pages in the SfDataPager. |
PagedSource
Gets the PagedSource of the SfDataPager, which is assigned to the item source of the datagrid.
Declaration
public PagedCollectionView PagedSource { get; }
Property Value
Type | Description |
---|---|
PagedCollectionView | The PagedCollectionView of SfDataPager. |
Remarks
The items source of the SfDataPager is set to the collection, based on which PagedSource is created internally. The ItemsSource is set as PagedSource.
Examples
sfPager.Source = viewModel.Info;
sfGrid.ItemsSource = sfPager.PagedSource;
See Also
PageIndex
Gets or sets the page index, which indicates the current page index.
Declaration
public int PageIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The current page index of SfDataPager. |
Examples
sfPager.Source = viewModel.Info;
sfGrid.ItemsSource = sfPager.PagedSource;
sfPager.PageIndex = 3;
PageSize
Gets or sets the page size, used to set total number of rows to be displayed in the grid.
Declaration
public int PageSize { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The total number of rows to be displayed in the grid. |
Examples
sfPager.Source = viewModel.Info;
sfGrid.ItemsSource = sfPager.PagedSource;
sfPager.PageSize = 15;
See Also
SelectionForeground
Gets or sets a Color, which is set as foreground color of the selected NumericButtons.
Declaration
public Color SelectionForeground { get; set; }
Property Value
Type |
---|
Android.Graphics.Color |
Source
Gets or sets the items source of the SfDataPager. SfDataPager is bind to the observable collection of data. This property is set only when normal paging is used, since setting this property loads all the items to the grid initially.
Declaration
public IEnumerable Source { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.IEnumerable | The items source of the SfDataPager. |
Remarks
The items source of the SfDataPager is set to the collection, based on which PagedSource is created internally. The ItemsSource is set as PagedSource.
The items can be loaded in the Datapager by two ways: normal paging and on demand paging. In normal paging, all the items are loaded initially when the grid is loaded. In on demand paging, the items are loaded to the grid only when navigating to the page i.e. items are loaded dynamically on demand. Source property should not be assigned when on demand paging is used.
Examples
sfPager.Source = viewModel.Info;
sfGrid.ItemsSource = sfPager.PagedSource;
See Also
UseOnDemandPaging
Gets or sets a value indicating whether to enable/disable OnDemandPaging. SfDataPager enables the user to generate the items for the current page dynamically by using this property. When on demand paging is enabled, the generation of items is handled by the OnDemandLoading event, hence it is necessary to hook the OnDemandLoading. The user cannot assign a value to the Source when using on demand paging, since the items for the current page is generated only when navigated to that page.
Declaration
public bool UseOnDemandPaging { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if on demand paging is enabled, otherwise false. The default value is false. |
Remarks
In normal Paging, data collection is entirely loaded initially to the SfDataPager. However, SfDataGrid also allows the user to load the data for the current page dynamically by setting the setting this property to true. To load current page item dynamically you must hook the OnDemandLoading event. In the OnDemandLoading event, use the LoadDynamicItems(Int32, IEnumerable) method to load the data for the corresponding page in SfDataPager.
Examples
sfPager.UseOnDemandPaging = true;
sfPager.OnDemandLoading += sfPager_OnDemandLoading;
private void OnDemandPageLoading(object sender, OnDemandLoadingEventArgs args)
{
sfDataPager.LoadDynamicItems(args.StartIndex, source.Skip(args.StartIndex).Take(args.PageSize));
}
See Also
Methods
add_OnDemandLoading(OnDemandLoadingEventHandler)
Declaration
public void add_OnDemandLoading(OnDemandLoadingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
OnDemandLoadingEventHandler | value |
add_PageIndexChanged(PageIndexChangedEventHandler)
Declaration
public void add_PageIndexChanged(PageIndexChangedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
PageIndexChangedEventHandler | value |
add_PageIndexChanging(PageIndexChangingEventHandler)
Declaration
public void add_PageIndexChanging(PageIndexChangingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
PageIndexChangingEventHandler | value |
Dispose(Boolean)
Releases the unmanaged resources used by the component and optionally releases the managed resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | if true - release both managed and unmanaged resources; if false - release only unmanaged resources. |
LoadDynamicItems(Int32, IEnumerable)
This method dynamically loads items into the PagedSource on demand. This method is used when UseOnDemandPaging is enabled to load the items dynamically to the page only when navigating to the page.
Declaration
public void LoadDynamicItems(int startIndex, IEnumerable items)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | startIndex | The start index of the items to be loaded. |
System.Collections.IEnumerable | items | The items to be loaded in the page. |
See Also
MoveToFirstPage()
Moves to the first page. This method is used to navigate to the first page programmatically.
Declaration
public void MoveToFirstPage()
MoveToLastPage()
Moves to the last page. This method is used to navigate to the last page programmatically.
Declaration
public void MoveToLastPage()
MoveToNextPage()
Moves to the next page. This method is used to navigate to the next page programmatically.
Declaration
public void MoveToNextPage()
MoveToPage(Int32)
Moves to the given page index. This method is used to navigate to the desired page programmatically.
Declaration
public void MoveToPage(int pageIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageIndex | The page index to move to. |
MoveToPage(Int32, Boolean)
Moves to the given page index. This method is used to navigate to the desired page programmatically.
Declaration
public void MoveToPage(int pageIndex, bool isEllipsisElementClicked)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageIndex | The page index to move to. |
System.Boolean | isEllipsisElementClicked | The boolean value indicating whether the Ellipsis element is clicked. |
MoveToPreviousPage()
Moves to the previous page. This method is used to navigate to the previous page programmatically.
Declaration
public void MoveToPreviousPage()
OnAttachedToWindow()
Occurs when the view is attached to the window.
Declaration
protected override void OnAttachedToWindow()
OnLayout(Boolean, Int32, Int32, Int32, Int32)
Positions and sizes the content of the data pager.
Declaration
protected override void OnLayout(bool changed, int left, int top, int right, int bottom)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | changed | True if the size of the view is changed, otherwise false. |
System.Int32 | left | A value that represents the x coordinate of the child. |
System.Int32 | top | A value that represents the y coordinate of the child. |
System.Int32 | right | A value that represents the width of the child. |
System.Int32 | bottom | A value that represents the height of the child. |
OnMeasure(Int32, Int32)
Raises the measure event.
Declaration
protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | widthMeasureSpec | Width measure spec. |
System.Int32 | heightMeasureSpec | Height measure spec. |
remove_OnDemandLoading(OnDemandLoadingEventHandler)
Declaration
public void remove_OnDemandLoading(OnDemandLoadingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
OnDemandLoadingEventHandler | value |
remove_PageIndexChanged(PageIndexChangedEventHandler)
Declaration
public void remove_PageIndexChanged(PageIndexChangedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
PageIndexChangedEventHandler | value |
remove_PageIndexChanging(PageIndexChangingEventHandler)
Declaration
public void remove_PageIndexChanging(PageIndexChangingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
PageIndexChangingEventHandler | value |
Events
OnDemandLoading
Occurs when loading the page on demand. This event fires only when UseOnDemandPaging is enabled.
Declaration
public event OnDemandLoadingEventHandler OnDemandLoading
Event Type
Type |
---|
OnDemandLoadingEventHandler |
Remarks
In normal Paging, data collection is entirely loaded initially to the SfDataPager. However, SfDataGrid also allows the user to load the data for the current page dynamically by setting the setting this property to true. To load current page item dynamically you must hook the OnDemandLoading event. In the OnDemandLoading event, use the LoadDynamicItems(Int32, IEnumerable) method to load the data for the corresponding page in SfDataPager.
Examples
sfPager.UseOnDemandPaging = true;
sfPager.OnDemandLoading += sfPager_OnDemandLoading;
private void OnDemandPageLoading(object sender, OnDemandLoadingEventArgs args)
{
sfDataPager.LoadDynamicItems(args.StartIndex, source.Skip(args.StartIndex).Take(args.PageSize));
}
See Also
PageIndexChanged
Occurs when PageIndexChanged. This event fires when the user navigates form one page to another page.
Declaration
public event PageIndexChangedEventHandler PageIndexChanged
Event Type
Type |
---|
PageIndexChangedEventHandler |
Examples
sfPager.PageIndexChanged += sfPager_PageIndexChanged;
private void sfPager_PageIndexChanged (object sender, PageIndexChangedEventArgs args)
{
// The user can get the old page index and the new page index here.
}
See Also
PageIndexChanging
Occurs when PageIndexChanging. This event fires when the user navigation form one page to another page begins.
Declaration
public event PageIndexChangingEventHandler PageIndexChanging
Event Type
Type |
---|
PageIndexChangingEventHandler |
Examples
sfPager.PageIndexChanging += sfPager_PageIndexChanging;
private void sfPager_PageIndexChanging (object sender, PageIndexChangingEventArgs args)
{
// The user can get the old page index and get or set the new page index here.
}