Hello,
we have changed the Grid behaviour to support a "Single Group Expand/Collapse" mechanism. The property "GroupsDefaultExpanded" is set to false on the MasterTableView. Paging is set to false by default, the PageSize is set to 15 by default.
The DataSource contains 150 items, which are configured to build 5 groups.
When a group is expanded, the ItemCommand event handler is called, which collapses all group headers and expands the currently selected. AllowPaging is set to true and then "Rebind()" is called.
Consider the following scenario:
1.) The page is initially called.
2.) The DataSource is added in the NeedDataSource event.
3.) The Grid is build with 5 groups, no paging enabled, all is fine.
4.) The third group expand button is clicked.
5.) The ItemCommand event handler gets called and processes the steps as defined above.
6.) The NeedDataSource event handler gets called and retrieved the Items based on the selected group header. (This data is transfered from the ItemCommand event handler). The DataSource contains now 34 entries. 4 just to build the groups, and 30 detail entries for the group to expand.
7.) The ItemCreated and ItemDataBound event handler gets called.
Result:
The page now displays 3 Groups, the second with an expanded image button, but no items in the group. The paging bar contains figures for the three pages. Now I click on the second page, back to the first page.
After that, the first page is displayed as expected: The first and second Groups are collapsed, the third is openned and displays the items.
When now another group (say the second) is openned, the same happens: The first group is initial collapsed, the second expanded, but no items in it. After using paging, the page looks like expected.
Could you please help me to determine the issue, why group items are displayed only after a paging event? Is there some call missing?
Following is some Code from the ItemCommand event handler:
Thanks for your support!
Sincereley,
Johann
we have changed the Grid behaviour to support a "Single Group Expand/Collapse" mechanism. The property "GroupsDefaultExpanded" is set to false on the MasterTableView. Paging is set to false by default, the PageSize is set to 15 by default.
The DataSource contains 150 items, which are configured to build 5 groups.
When a group is expanded, the ItemCommand event handler is called, which collapses all group headers and expands the currently selected. AllowPaging is set to true and then "Rebind()" is called.
Consider the following scenario:
1.) The page is initially called.
2.) The DataSource is added in the NeedDataSource event.
3.) The Grid is build with 5 groups, no paging enabled, all is fine.
4.) The third group expand button is clicked.
5.) The ItemCommand event handler gets called and processes the steps as defined above.
6.) The NeedDataSource event handler gets called and retrieved the Items based on the selected group header. (This data is transfered from the ItemCommand event handler). The DataSource contains now 34 entries. 4 just to build the groups, and 30 detail entries for the group to expand.
7.) The ItemCreated and ItemDataBound event handler gets called.
Result:
The page now displays 3 Groups, the second with an expanded image button, but no items in the group. The paging bar contains figures for the three pages. Now I click on the second page, back to the first page.
After that, the first page is displayed as expected: The first and second Groups are collapsed, the third is openned and displays the items.
When now another group (say the second) is openned, the same happens: The first group is initial collapsed, the second expanded, but no items in it. After using paging, the page looks like expected.
Could you please help me to determine the issue, why group items are displayed only after a paging event? Is there some call missing?
Following is some Code from the ItemCommand event handler:
if (e.CommandName == RadGrid.ExpandCollapseCommandName) |
{ |
GridGroupHeaderItem groupHeaderItem = (GridGroupHeaderItem) e.Item; |
GridItem[] groupHeaderItems = grid.MasterTableView.GetItems(GridItemType.GroupHeader); |
// collapse all group header items currently on the page to support a "single open group" effect |
foreach (GridGroupHeaderItem grpHeaderItem in groupHeaderItems) |
{ |
grpHeaderItem.Expanded = false; |
} |
// When "Expand" is clicked, the expanded state is set to false. Therefore, the division from this group header |
// needs to be read. When "Collapse" is clicked, the state is assigned "true" |
if (!groupHeaderItem.Expanded) |
{ |
string currentDivision = this.GetDivisionFromGroupHeader(groupHeaderItem); |
new ObjectLifecycleHelper(this.Page, this.ViewState).SetCurrentSelectedGridDivision(currentDivision); |
groupHeaderItem.Expanded = true; |
} |
if (!grid.AllowPaging) |
{ |
grid.AllowPaging = true; |
grid.PageSize = 15; |
} |
// rebind in each case, because otherwise the Expanded/Collapsed state is not changed by the view |
grid.Rebind(); |
Thanks for your support!
Sincereley,
Johann