But when I am using Grouping on the datagrid the Pager returns 5 Group headers per page and the actual records are much more...
Is there a way to fix it?
<
telerik:RadDataPager
Grid.Row
=
"3"
x:Name
=
"radDataPager"
Source
=
"{Binding SearchResults}"
PageSize
=
"5"
DisplayMode
=
"All"
IsTotalItemCountFixed
=
"True"
/>
<
telerik:RadGridView
x:Name
=
"grdSearchResults"
Grid.Row
=
"4"
ItemsSource
=
"{Binding PagedSource, ElementName=radDataPager}"
IsBusy
=
"{Binding IsSearchActive}"
IsReadOnly
=
"True"
CanUserDeleteRows
=
"False"
CanUserInsertRows
=
"False"
ShowGroupPanel
=
"False"
Width
=
"auto"
AutoGenerateColumns
=
"False"
ReorderColumnsMode
=
"Interactive"
RowIndicatorVisibility
=
"Collapsed"
AutoExpandGroups
=
"True"
SelectionMode
=
"Extended"
>
<
telerik:RadGridView.GroupDescriptors
>
<
telerik:GroupDescriptor
Member
=
"AccountNumber"
SortDirection
=
"Ascending"
/>
<
telerik:GroupDescriptor
Member
=
"DocumentType"
SortDirection
=
"Ascending"
/>
</
telerik:RadGridView.GroupDescriptors
>
<
i:Interaction.Behaviors
>
<
Behaviors:MultiSelectBehavior
SelectedItems
=
"{Binding SelectedDocuments}"
/>
</
i:Interaction.Behaviors
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Header
=
"ID"
DataMemberBinding
=
"{Binding EntryId}"
/>
<
telerik:GridViewDataColumn
Header
=
"Status"
DataMemberBinding
=
"{Binding Status}"
/>
<
telerik:GridViewDataColumn
Header
=
"Created"
DataMemberBinding
=
"{Binding CreateDate}"
/>
<
telerik:GridViewSelectColumn
/>
</
telerik:RadGridView.Columns
>
<
i:Interaction.Triggers
>
<
i:EventTrigger
EventName
=
"RowActivated"
>
<
i:InvokeCommandAction
Command
=
"{Binding DisplayViewCommand}"
/>
</
i:EventTrigger
>
</
i:Interaction.Triggers
>
</
telerik:RadGridView
>
8 Answers, 1 is accepted
Please refer to this forum thread where the paging for a grouped RadGridView is discussed.
Greetings,Didie
the Telerik team
I do not follow how the forum thread you reffered applies to my case.
I am not using code behind and my RadDataPager is bound to ObservableCollection in my ViewModel.
Can you please clarify what should I do in order to fix the problem?
Here is the exact reply in this thread for more info.
Greetings,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Thank you for the fast reply. I am still confused as for where the PagedCollectionView should apply in my code?
Can you please give me detailed instructions on how to modify MY code?
Thanks
What we are trying to say is that the grid (and the collection behind the grid) will page groups by default - not group items. If your scenario is different you should implement your own paging logic using IPagedCollectionView.
Kind regards,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
So there is no way to change default behaviour? Then it is not default but very limited behaviour.
Of course I can implement my paging on my own just by using LINQ's abilities to page data using Skip() and Take() functions.
But that will prevent me from using out of the box RadDataPager control as I have for all other grids.
Why not to add a property to the RadDataPager that will control how the paging should work: by groups or by records?
As for IPagedCollectionView, can you provide a sample of how that should be implemented? (link to a documentation on the interface would be great!)
Thanks
We cannot add such property/behavior for RadDataPager since grouping is done very differently across various collections (standard CollectionView, our QueryableCollectionView, WCF RIA Services in Silverlight, etc.) while the pager is universal paging component and does not care/know anything about grouping.
I believe that you will find a lot of IPagedCollectionView implementations in the web including MSDN - our interface is exact copy of the original Silverlight interface.
Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
A quick follow-up. Here are two alternatives.
A. RadDataPager has the so called Unbound Mode.
Since you mentioned that you can Skip and Take on your flat collection, if you use the Unbound Mode you can Skip and Take on the respective event.
B. RadDataPager has a property called PagedSource. If you pass in the original collection to RadDataPager.Source, you will get the current page of data our from its PagedSource property. You can cast the PagedSource to INotifyCollectionChanged and respond to collection changes and fill another ObservableCollection with the data. Or you can wrap this PagedSource in another collection and internally respond to CollectionChaged's. The idea is to feed this other collection to RadGridView.ItemsSource so that paging happens before grouping.
The idea is to do the paging before the grouping so that RadGridView will never know that someone is paging its data. It will simply think that its ItemsSource is a collection with several items (i.e. PageSize) and will group these items.
source collection -> RadDataPager -> only one page of data -> RadGridView -> grouping will be done over this one page of data and the grid will never know what happened before it.
I hope this helps.
Ross
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>