Class PagedCollectionView
Represents the class that maintains the collection view of type paged collection view, when the SfDataGrid is bind to the paged collection view.
Implements
Inherited Members
Namespace: Syncfusion.UI.Xaml.Data
Assembly: Syncfusion.Data.WinUI.dll
Syntax
public class PagedCollectionView : QueryableCollectionView, ICollectionViewAdv, ICollectionView, IObservableVector<object>, IList<object>, ICollection<object>, IEnumerable<object>, IEnumerable, INotifyPropertyChanged, ISupportInitialize, IDisposable, IEditableCollectionView, IUnboundExpressionFunc, IGridViewNotifier, IFilterPredicateExpression, IParallelizableView, IPagedCollectionView
Constructors
PagedCollectionView()
Initializes a new instance of the PagedCollectionView class.
Declaration
public PagedCollectionView()
PagedCollectionView(IEnumerable)
Initializes a new instance of the PagedCollectionView class.
Declaration
public PagedCollectionView(IEnumerable source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IEnumerable | source | The IEnumerable source of the SfDataGrid. |
Fields
OnDemandPageCache
Gets the on demand paged cache which contains the cache of the records in the previous page.
Declaration
protected Dictionary<int, IEnumerable> OnDemandPageCache
Field Value
Type |
---|
System.Collections.Generic.Dictionary<System.Int32, System.Collections.IEnumerable> |
Properties
CanAddNew
Gets a value that indicates whether a new item can be added to the collection.
Declaration
public override bool CanAddNew { get; }
Property Value
Type | Description |
---|---|
System.Boolean | True if a new item can be added to the collection, otherwisefalse. |
Overrides
EnableSummaryOptimization
Gets or sets a boolean value that indicates whether to enable optimistic summary calculation on real time updates.
Declaration
public override bool EnableSummaryOptimization { get; }
Property Value
Type | Description |
---|---|
System.Boolean | A boolean value that indicates whether to enable optimistic summary calculation on real time updates. |
Overrides
Remarks
The EnableSummaryOptimization calculates the summary optimistically when the data objects implement the System.ComponentModel.INotifyPropertyChanging and System.ComponentModel.INotifyPropertyChanged.
FilterPredicates
Gets or sets the collection of FilterPredicates, based on which filtering is performed in the underlying collection.
Declaration
public override ObservableCollection<IFilterDefinition> FilterPredicates { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ObservableCollection<IFilterDefinition> | The collection of FilterPredicates, based on which filtering is performed in the underlying collection. |
Overrides
ItemCount
Gets the number of items in the collection view.
Declaration
public int ItemCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of items in the collection view. |
MaxItemsCount
Gets or sets the maximum items count in the paged collection view.
Declaration
public int MaxItemsCount { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The maximum items count in the paged collection view. |
PageCount
Gets the number of pages in the paged collection view.
Declaration
public virtual int PageCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of pages in the paged collection view. |
PageIndex
Gets the page index of the current page.
Declaration
public int PageIndex { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The page index of the current page. |
PageSize
Gets or sets the page size, which indicates the number of rows to be displayed in the page.
Declaration
public int PageSize { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The page size, which indicates the number of rows to be displayed in the page. |
TotalItemCount
Gets the total items count in the collection view.
Declaration
public int TotalItemCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The total items count in the collection view. |
UseOnDemandPaging
Gets or sets a boolean value indicating whether to use on demand paging, when on demand paging is enabled the items will be populated to the page only when navigated to the page.
Declaration
public bool UseOnDemandPaging { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | A boolean value indicating whether to use on demand paging. |
Methods
add_OnDemandItemsLoading(OnDemandItemsLoadingEventHandler)
Declaration
public void add_OnDemandItemsLoading(OnDemandItemsLoadingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
OnDemandItemsLoadingEventHandler | value |
AdjustBeforeAdd(Object, Int32)
Adjust the underlying collection by getting the comparer index before adding the given record at the given index in the view.
Declaration
protected override int AdjustBeforeAdd(object record, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Object | record | The record to be added to the collection. |
System.Int32 | index | The index at which the record is to be added. |
Returns
Type | Description |
---|---|
System.Int32 | Gets the comparer index based on the given index and records in the collection. |
Overrides
CommitEdit()
Ends the edit transaction and saves the pending changes.
Declaration
public override void CommitEdit()
Overrides
CreateRecords()
Creates the records for the items in the source of the collection view.
Declaration
protected override RecordsList CreateRecords()
Returns
Type | Description |
---|---|
RecordsList | The list of records created for the items in the source of the collection view. |
Overrides
EnsureView()
Ensures sorting, grouping and filtering by refreshing the view with updated collection.
Declaration
protected override void EnsureView()
Overrides
GetComparerIndex(Object, Int32)
Compares the given index and the index corresponding to the given record.
Call this method when you need to find the compared index of item based on sorting
Declaration
protected override int GetComparerIndex(object record, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Object | record | The record whose index is to be compared with the given index. |
System.Int32 | index | The index which is to be compared |
Returns
Type | Description |
---|---|
System.Int32 | Gets the comparer index based on the given index and the index corresponding to the given record. |
Overrides
GetGroupResult(String[])
Gets the IEnumerable collection of group result for the array of group-by.
Declaration
protected override IEnumerable<GroupResult> GetGroupResult(string[] groupBy)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | groupBy | The array of groups |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<GroupResult> | The IEnumerable collection of group result for the array of group-by. |
Overrides
GetQueryableSource()
Returns the IQueryable source of the collection view.
Declaration
protected override IQueryable GetQueryableSource()
Returns
Type | Description |
---|---|
System.Linq.IQueryable | The IQueryable source of the collection view. |
Overrides
Remarks
PagedCollectionView returns paged source as IQueryable. Returning query will be sorted query in the case of normal VirtualizingCollectionView. It will be sorted and filtered query in the case of PagedCollectionVeiw and OnDemand VirtualizingCollectionView.
LoadDynamicItems(Int32, IEnumerable)
Loads the given items starting from the given page index, dynamically to the page.
Declaration
public void LoadDynamicItems(int startIndex, IEnumerable items)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | startIndex | The start index to load the items. |
System.Collections.IEnumerable | items | The items to be loaded to the page. |
MoveToFirstPage()
Moves to the first page.
Declaration
public bool MoveToFirstPage()
Returns
Type | Description |
---|---|
System.Boolean | Returns a boolean value indicating whether moved to the first page or not. |
MoveToLastPage()
Moves to the last page.
Declaration
public bool MoveToLastPage()
Returns
Type | Description |
---|---|
System.Boolean | Returns a boolean value indicating whether moved to the last page or not. |
MoveToNextPage()
Moves to the next page.
Declaration
public bool MoveToNextPage()
Returns
Type | Description |
---|---|
System.Boolean | Returns a boolean value indicating whether moved to the next page or not. |
MoveToPage(Int32)
Moves to the given page index.
Declaration
public virtual bool MoveToPage(int pageIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageIndex | The page index to move to. |
Returns
Type | Description |
---|---|
System.Boolean | Returns a boolean value indicating whether moved to the given page or not. |
MoveToPreviousPage()
Moves to the previous page.
Declaration
public bool MoveToPreviousPage()
Returns
Type | Description |
---|---|
System.Boolean | Returns a boolean value indicating whether moved to the previous page or not. |
NotifyPropertyChangedHandler(Object, PropertyChangedEventArgs)
This method fires when the property is changed.
Declaration
protected override void NotifyPropertyChangedHandler(object sender, PropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The sender of the event. |
System.ComponentModel.PropertyChangedEventArgs | e | The System.ComponentModel.PropertyChangedEventArgs that contains the event for the data. |
Overrides
RefreshFilter(Boolean)
Refreshes the view when the filtering is applied through FilterRecord(Object) delegate.
Declaration
public override void RefreshFilter(bool isProgrammatic = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isProgrammatic | A boolean value indicating whether filtering is done programmatically. |
Overrides
RefreshSort()
Refreshes sorting in the underlying collection of the SfDataGrid.
Declaration
protected override void RefreshSort()
Overrides
Remove(Object)
Removes the given item from the collection.
Declaration
public override bool Remove(object item)
Parameters
Type | Name | Description |
---|---|---|
System.Object | item | The item to be removed. |
Returns
Type |
---|
System.Boolean |
Overrides
remove_OnDemandItemsLoading(OnDemandItemsLoadingEventHandler)
Declaration
public void remove_OnDemandItemsLoading(OnDemandItemsLoadingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
OnDemandItemsLoadingEventHandler | value |
ResetCache()
Clears the cache while using OnDemandPaging.
Declaration
public void ResetCache()
Remarks
While navigating between pages, records are loaded through OnDemandItemsLoading event and the loaded records will be maintained in cache. If you navigate to already navigated page, then records are loaded from cache and the OnDemandItemsLoading event will not fire for that corresponding page. You can clear the cache by using this method and now the OnDemandItemsLoading event will be raised when you navigate to the same page. And the records will be loaded through event instead of loading from cache.
ResetCacheForPage(Int32)
Reset the cache to the given page index.
Declaration
public void ResetCacheForPage(int pageIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageIndex | Index of the page to reset its cache. |
See Also
SetSource(IEnumerable)
Sets the given source to the collection view.
Declaration
protected override void SetSource(IEnumerable _source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IEnumerable | _source | The source to be set to the collection view. |
Overrides
UpdateCollectionView(Object, NotifyCollectionChangedEventArgs)
This method fires when the collection is changed.
Declaration
protected override void UpdateCollectionView(object sender, NotifyCollectionChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The original sender of the event. |
System.Collections.Specialized.NotifyCollectionChangedEventArgs | e | The System.Collections.Specialized.NotifyCollectionChangedAction which represents the collection changed action. |
Overrides
Events
OnDemandItemsLoading
Occurs when the items are loaded on demand to the page.
Declaration
public event OnDemandItemsLoadingEventHandler OnDemandItemsLoading
Event Type
Type |
---|
OnDemandItemsLoadingEventHandler |
PageChanged
Occurs when the page is changed.
Declaration
public event EventHandler<PageChangedEventArgs> PageChanged
Event Type
Type |
---|
System.EventHandler<PageChangedEventArgs> |
PageChanging
Occurs when the page is changing.
Declaration
public event EventHandler<PageChangingEventArgs> PageChanging
Event Type
Type |
---|
System.EventHandler<PageChangingEventArgs> |