This is a migrated thread and some comments may be shown as answers.

Grouping and Paging not working 100%

9 Answers 237 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris @ Intrinsic
Top achievements
Rank 1
Chris @ Intrinsic asked on 04 Jan 2011, 10:12 PM

If I have both paging and grouping enabled on the same grid,  the page gets cut off on the grid, so that the paging selector on the bottom of the grid sometimes doesn't show up at all, and sometimes will be partially cut off.  If I remove the grouping functionality, the paging works 100%.  I definitely need paging, as the grid is not very tall, so the data cannot be contained on one page.   I've tried seting the height of the grid, and setting the page size to something ridiculously low like 3, but the paging control still gets at least partially cut off, so I dont see how to get the grid working properly with both paging and grouping.

heres the code for the grid that is being cut off: 

 

 

 

<telerik:RadGrid ID="RadGrid2" runat="server" AllowSorting="true" AutoGenerateColumns="false"PageSize="4" AllowPaging="True" OnNeedDataSource="RadGrid2_NeedDataSource" Height="300px" ShowGroupPanel="false">
<MasterTableView>
<GroupByExpressions>
<telerik:GridGroupByExpression>
<SelectFields>
<telerik:GridGroupByField FieldAlias="FiscalYear" FieldName="FiscalYear" FormatString="{0:D}"HeaderValueSeparator=": "></telerik:GridGroupByField>
</SelectFields>
<GroupByFields>

 

 

 

 

 

 

 

<telerik:GridGroupByField FieldName="FiscalYear" SortOrder="Descending"></telerik:GridGroupByField>

 

 

 

 

 

 

 

</GroupByFields>

 

 

 

 

 

 

 

</telerik:GridGroupByExpression>

 

 

 

 

 

 

 

<telerik:GridGroupByExpression>

 

 

 

 

 

 

 

<SelectFields>

 

 

 

 

 

 

 

<telerik:GridGroupByField FieldAlias="Month" FieldName="Month" FormatString="{0:D}"

 

 

 

 

 

 

 

HeaderValueSeparator=": "></telerik:GridGroupByField>

 

 

 

 

 

 

 

</SelectFields>

 

 

 

 

 

 

 

<GroupByFields>

 

 

 

 

 

 

 

<telerik:GridGroupByField FieldName="Month" SortOrder="Ascending"></telerik:GridGroupByField>

 

 

 

 

 

 

 

</GroupByFields>

 

 

 

 

 

 

 

</telerik:GridGroupByExpression>

 

 

 

 

 

 

 

</GroupByExpressions>

 

 

 

 

 

 

 

<Columns>

 

 

 

 

 

 

 

<telerik:GridBoundColumn SortExpression="FiscalYear" HeaderText="Fiscal Year" DataField="FiscalYear" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right"></telerik:GridBoundColumn>

 

 

 

 

 

 

 

<telerik:GridBoundColumn SortExpression="Month" HeaderText="Month" DataField="Month" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right"></telerik:GridBoundColumn>

 

 

 

 

 

 

 

<telerik:GridBoundColumn SortExpression="Forecast" HeaderText="Forecast" DataField="Forecast" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right"></telerik:GridBoundColumn>

 

 

 

 

 

 

 

<telerik:GridBoundColumn SortExpression="Actuals" HeaderText="Actuals" DataField="Actuals" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"></telerik:GridBoundColumn>

 

 

 

 

 

 

 

</Columns>

 

 

 

 

 

 

 

</MasterTableView>

 

 

 

 

 

 

 

<PagerStyle Mode="NextPrev">

 

 

 

 

 

 

 

</PagerStyle>

 

 

 

 

 

 

 

</telerik:RadGrid>

 

9 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 05 Jan 2011, 04:10 PM
Hi Chris,

I followed your scenario in order to replicate the issue you are facing but to no avail. Please examine the attached test project and let me know what is the difference in your case.

All the best,
Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
alicja
Top achievements
Rank 1
answered on 10 Jan 2011, 09:18 AM
Hi,

I have the same problem. I am using custom paging and I return only 20 records for a page. When I switch off grouping then paging works appropriately.

Here is my code:

<

 

ec:RadDataGridView ID="rgKalendarze" DataSourceID="odsKalendarze" runat="server" PageSize="20" AllowSorting="True" AllowPaging="True" AllowCustomPaging="true" ShowGroupPanel="True" AutoGenerateColumns="False" GridLines="None" CssClass="gridStyleLeft" AllowAutomaticUpdates="true" OnItemCommand="rgKalendarze_ItemCommand">
<PagerStyle Mode="NumericPages"></PagerStyle>
<MasterTableView Width="100%" GroupLoadMode="Client" TableLayout="Auto" GroupsDefaultExpanded="true"
CommandItemDisplay="Top" AllowPaging="True" AllowCustomPaging="true">
<GroupByExpressions>
<telerik:GridGroupByExpression>
<SelectFields>
<telerik:GridGroupByField FieldAlias="DataTransakcji" FieldName="DataTransakcji" FormatString="{0:d}">
</telerik:GridGroupByField>
</SelectFields>
<GroupByFields>
<telerik:GridGroupByField FieldName="DataTransakcji" SortOrder="Descending"></telerik:GridGroupByField>
</GroupByFields>
</telerik:GridGroupByExpression>
<telerik:GridGroupByExpression>
<SelectFields>
<telerik:GridGroupByField FieldAlias="Tryb" FieldName="Tryb"></telerik:GridGroupByField>
</SelectFields>
<GroupByFields>
<telerik:GridGroupByField FieldName="Tryb"></telerik:GridGroupByField>
</GroupByFields>
</telerik:GridGroupByExpression>
</GroupByExpressions>
<Columns>
<telerik:GridTemplateColumn UniqueName="DataTransakcji" HeaderText="Data transakcji" AllowFiltering="false">
<ItemTemplate>
<asp:LinkButton ID="lbtnDataTransakcji" CommandName="Edit" runat="server"  Text='<%# GetDateFormat((((HParametry.KalendarzDataWalutyZagr)Container.DataItem).DataTransakcji)) %>' CommandArgument="<%# ((GridItem) Container).RowIndex %>" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="Tryb" HeaderText="Tryb" AllowFiltering="false">
<ItemTemplate>
<asp:LinkButton ID="lbtnTryb" CommandName="Edit" runat="server" Text='<%# (((HParametry.KalendarzDataWalutyZagr)Container.DataItem).Tryb) %>' CommandArgument="<%# ((GridItem) Container).RowIndex %>" /></ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn DataField="Waluta.SymbolLitery" DataType="System.String" HeaderText="Typ jednostki" UniqueName="Waluta.SymbolLitery" HeaderStyle-HorizontalAlign="Center" SortExpression="Waluta.SymbolLitery" />
<telerik:GridTemplateColumn UniqueName="DataWaluty" HeaderText="Data waluty" AllowFiltering="false">
<ItemTemplate>
<asp:LinkButton ID="lbtnDataWaluty" CommandName="Edit" runat="server" Text='<%# GetDateFormat((((HParametry.KalendarzDataWalutyZagr)Container.DataItem).DataWaluty)) %>' CommandArgument="<%# ((GridItem) Container).RowIndex %>" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridEditCommandColumn HeaderText="Edycja" ButtonType="PushButton" EditText="Edytuj" Reorderable="False" Resizable="False">
</telerik:GridEditCommandColumn>
</Columns>
<CommandItemTemplate>
</CommandItemTemplate>
<EditFormSettings EditFormType="Template">
<FormTemplate>
<div style="padding: 10px; text-align: left;">
<p><strong>Edycja wpisu do kalendarza</strong></p>
<table>
<hfc:HiddenFieldLong ID="hfOid" runat="server" DbValue='<%# Bind("Oid")%>' />
<hfc:HiddenFieldInt ID="hfWersja" runat="server" DbValue='<%# Bind("Wersja")%>' />
<tr>
<td>Data transakcji</td>
<td><me:TextBoxDateTime ID="tbDataTransakcji" runat="server" Text='<%# Bind("DataTransakcji") %>' Width="200" Enabled="false"></me:TextBoxDateTime>
</td>
</tr>
<tr>
<td>Tryb waluty transakcji</td>
<td>
<me:TextBoxSimple ID="tbTryb" runat="server" Text='<%# Bind("Tryb") %>' MaxLength="30" Width="200" Enabled="false"></me:TextBoxSimple></td>
</tr>
<tr>
<td>Data waluty (*)</td>
<td>
<me:TextBoxDateTime ID="tbDataWaluty" runat="server" Text='<%# Bind("DataWaluty") %>' Width="200" RequiredFieldMessage="Data waluty - Pole wymagane"></me:TextBoxDateTime></td>
</tr>
<tr>
<td>Waluta</td>
<td><ec:DropDownListExt ID="ddlWaluty" runat="server" DataSourceID="odsWaluty" DataTextField="SymbolLitery" DataValueField="Oid" AppendDataBoundItems="true" AutoPostBack="true" DbValue='<%# Bind("OidWaluta") %>'>
<asp:ListItem Text="Wybierz" Value=""></asp:ListItem></ec:DropDownListExt></td>
</tr>
</table>
</div><p>
<ec:ButtonExtRights ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Dodaj" : "Zapisz" %>'
runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' />
<ec:ButtonExtended ID="btnCancel" Text="Anuluj" runat="server" CausesValidation="False" CommandName="Cancel" /></p>
</FormTemplate>
</EditFormSettings>
</MasterTableView>
<ClientSettings AllowGroupExpandCollapse="True" ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True">
</ClientSettings>
<GroupingSettings ShowUnGroupButton="true" />
</ec:RadDataGridView >

 

 

<asp:ObjectDataSource ID="odsKalendarze" runat="server" DataObjectTypeName="HParametry.KalendarzDataWalutyZagr" TypeName="DataLayer.Service.Impl.ParametryServiceImpl" EnablePaging="true" SelectMethod="Select" SelectCountMethod="SelectCount" UpdateMethod="SaveObject" OnSelecting="odsKalendarze_Selecting">
<SelectParameters>
<asp:Parameter Name="type" DefaultValue="HParametry.KalendarzDataWalutyZagr" />
</SelectParameters>
</asp:ObjectDataSource>

Alicja.

 

0
Pavlina
Telerik team
answered on 10 Jan 2011, 12:30 PM
Hello,

Please examine this online demo which demonstrates how you can achieve the desired functionality and see what is the difference in your scenario.

All the best,
Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Chris @ Intrinsic
Top achievements
Rank 1
answered on 10 Jan 2011, 06:18 PM
I looked at the online demos, and followed the same method.  For now, I just set the page size to 5, as the grid is not very big, so it's working now, so far.  I might have to revisit this code later on in the project, but for now I'm leaving it as is.  I will update you if I have any more issues.
thanks.
0
Pavlina
Telerik team
answered on 11 Jan 2011, 01:41 PM
Hello,

I will gladly assist you if other questions or problems arise.

All the best,
Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
alicja
Top achievements
Rank 1
answered on 12 Jan 2011, 09:21 AM
Hello,

I examined your online demo. The difference between your example and my code is that I wrote code to actually fetch only 20 records while grouping. In your demo, while grouping you fetch all records and only show 10 on a page. So my question is: can grouping be applied to only eg. 20 records fetched for one page?

Alicja.
0
Pavlina
Telerik team
answered on 13 Jan 2011, 04:23 PM
Hello,

Indeed the RadGrid control requires the whole data source(all records) in order to perform grouping. After the grouping is finished then paging is performed. Thus grouping is performed on all items regardless whether they are on current page or not.

However in case of custom paging - developer is responsible for supplying the data and if only page size items are set as DataSource of RadGrid it will perform grouping only those items.

Best wishes,
Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
alicja
Top achievements
Rank 1
answered on 15 Jan 2011, 02:33 PM
Hello Pavlina,

thank you for your answer. Indeed in my example RadGrid performed grouping of only those items I fetched. But grouping of items also caused that paging started to work incorrectly. The Pager started to show that only 1 page is available and only those items I fetched are available. When I ungroup items, the Pager shows all pages and items correctly.

Alicja.
0
Pavlina
Telerik team
answered on 19 Jan 2011, 10:55 AM
Hi,

I would ask you to isolate the grid in a runnable sample and send it to us. Thus I will be able to review it locally and advise you further. Other than this I am not able to determine the source of the described behavior.

Thank you for your cooperation in advance.

Greetings,
Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Chris @ Intrinsic
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
alicja
Top achievements
Rank 1
Chris @ Intrinsic
Top achievements
Rank 1
Share this question
or