I have a radgrid that displays selfhierarchical records. When I have the following set:
The hierarchy (regardless of how many levels) is displayed correctly and everything works as expected. However, if I turn paging on as using AllowPaging="True", things start to fall apart in that the grid will display two levels of hierarcy for SOME records (when there should be three) and NONE for others (when there should be ONE). In addition, if I have the detail records expanded for all visible parent nodes, some of the detail records aren't displayed until I change the number of results for that page (e.g., from 10 to 20) even though there are only five detail records (when it's set to 10, two are displayed, when I change it to 20, all five are displayed). (This is being changed via the pager control and not via the PageSize setting.)
Here is the code for the radgrid. The datasource is set when the user loads the page and is dynamic. It is not set at markup time.
Here's the code behind refreshing the datasource:
Here's the kicker...when I set PageSize=50 (from the default of 10), all records (there are 24 that I'm working with) appear to show up correctly -- on the all three levels that I'm expecting. When I set PageSize=20 and then run it, I get the same issues as when I set it to 10, only less so.
With that in mind, I believe there's an issue with paging and hierarchy when the number of TOTAL records in the datasource exceeds the PageSize, regardless of where they are in the hierarchy level.
Is this a known issue or is there something I'm missing that's causing me to experience this wackiness? We are using the latest release (2009 Q1) FWIW.
AllowPaging="False" |
AllowCustomPaging="False" |
EnableLinqExpressions="True" |
-OR- |
AllowPaging="False" |
AllowCustomPaging="True" |
EnableLinqExpressions="True" |
The hierarchy (regardless of how many levels) is displayed correctly and everything works as expected. However, if I turn paging on as using AllowPaging="True", things start to fall apart in that the grid will display two levels of hierarcy for SOME records (when there should be three) and NONE for others (when there should be ONE). In addition, if I have the detail records expanded for all visible parent nodes, some of the detail records aren't displayed until I change the number of results for that page (e.g., from 10 to 20) even though there are only five detail records (when it's set to 10, two are displayed, when I change it to 20, all five are displayed). (This is being changed via the pager control and not via the PageSize setting.)
Here is the code for the radgrid. The datasource is set when the user loads the page and is dynamic. It is not set at markup time.
<telerik:RadGrid |
ID="grdNotes" |
runat="server" |
OnColumnCreated="grdNotes_ColumnCreated" |
OnItemCreated="grdNotes_ItemCreated" |
OnItemDataBound="grdNotes_ItemDataBound" |
OnNeedDataSource="grdNotes_NeedDataSource" |
AutoGenerateColumns="False" |
AllowPaging="True" |
AllowCustomPaging="True" |
ShowStatusBar="True" |
EnableLinqExpressions="True" PageSize="10" |
> |
<HeaderContextMenu |
EnableTheming="True"> |
<CollapseAnimation |
Type="OutQuint" |
Duration="200"> |
</CollapseAnimation> |
</HeaderContextMenu> |
<ClientSettings > |
<Selecting AllowRowSelect="True" /> |
<ClientEvents |
OnRowCreated="RowCreated" |
OnRowSelected="RowSelected" |
OnRowDblClick="grdNotes_OnRowDblClick"> |
</ClientEvents> |
</ClientSettings> |
<PagerStyle |
HorizontalAlign="Center" |
Position="Bottom" |
AlwaysVisible="True" |
Mode="NextPrevAndNumeric" |
Wrap="False" |
BackColor="White" |
Font-Size="Large" |
/> |
<MasterTableView |
HierarchyDefaultExpanded="true" |
HierarchyLoadMode="Client" |
AllowSorting="true" |
DataKeyNames="Id,ParentId" |
ClientDataKeyNames="Id,ParentId" |
Width="100%" |
AutoGenerateColumns="false" |
ShowHeader="true" |
NoDetailRecordsText="" |
enablenorecordstemplate="False" |
> |
<SelfHierarchySettings |
ParentKeyName="ParentId" |
KeyName="Id" |
MaximumDepth="20" /> |
<RowIndicatorColumn> |
<HeaderStyle Width="20px"></HeaderStyle> |
</RowIndicatorColumn> |
<ExpandCollapseColumn visible="True"> |
<HeaderStyle Width="20px"></HeaderStyle> |
</ExpandCollapseColumn> |
<Columns> |
<telerik:GridBoundColumn DataField="Id" HeaderText="Id" SortExpression="Id" UniqueName="Id" ReadOnly="True"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="Title" HeaderText="Title" SortExpression="Title" UniqueName="Title"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="Body" HeaderText="Body" SortExpression="Body" UniqueName="Body"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="CreatedBy" HeaderText="Created By" SortExpression="CreatedBy" UniqueName="CreatedBy"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="CreatedDate" HeaderText="Created On" SortExpression="CreatedDate" UniqueName="CreatedOn"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="ModifiedDate" HeaderText="Modified On" SortExpression="ModifiedDate" UniqueName="ModifiedOn"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="ParentId" HeaderText="Parent Id" SortExpression="ParentId" UniqueName="ParentId" visible="false"> |
</telerik:GridBoundColumn> |
</Columns> |
</MasterTableView> |
<FilterMenu EnableTheming="True"> |
<CollapseAnimation |
Type="OutQuint" |
Duration="200"> |
</CollapseAnimation> |
</FilterMenu> |
</telerik:RadGrid> |
Here's the code behind refreshing the datasource:
protected void grdNotes_NeedDataSource(object source, GridNeedDataSourceEventArgs e) |
{ |
RefreshGridDataSource(); |
} |
private void RefreshGridDataSource() |
{ |
NoteDataProvider noteDataProvider = new NoteDataProvider(WebServicesUri, TicketIdentity.Current.Ticket); |
List<DisplayNote> displayNotes = noteDataProvider.GetAll(ObjectId); |
grdNotes.DataSource = displayNotes; |
grdNotes.VirtualItemCount = displayNotes.Count; |
} |
Here's the kicker...when I set PageSize=50 (from the default of 10), all records (there are 24 that I'm working with) appear to show up correctly -- on the all three levels that I'm expecting. When I set PageSize=20 and then run it, I get the same issues as when I set it to 10, only less so.
With that in mind, I believe there's an issue with paging and hierarchy when the number of TOTAL records in the datasource exceeds the PageSize, regardless of where they are in the hierarchy level.
Is this a known issue or is there something I'm missing that's causing me to experience this wackiness? We are using the latest release (2009 Q1) FWIW.