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

Grouping Programmatically makes Vertical Scroll useless

1 Answer 91 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kevin White
Top achievements
Rank 2
Kevin White asked on 11 Nov 2009, 03:20 PM
I use a background worker to load data into my grid. It is not bound, due to special requests by the users, I must insert each row manually. After inserting all the data to the grid, I add a programmatic GroupByExpression to automatically group when the grid renders in my application and programmatically expand all the groups.

However, after upgrading to the latest Telerik Winform controls (Q3 2009), the vertical scrollbar disappears -only- for the grids where I have programmatic grouping with automatic group expansion. Other grids in the application do not have any problems. 

Eventually I made the Vertical Scrollbar Visibility to be Always True. However, this still did not solve the problem. The scrollbar does not actually scroll. It is not recognizing that there are more rows to scroll down to. I've even tried manually adjusting the VScrollBar.Maximum value to no avail. 

The scroll will work again if I remove the group on client side, then re-add it, or if I collapse a group then re-expand it, again on client side. But this is cumbersome for users. One other thing to note, if I do not Expand All Groups, the vertical scrollbar shows up perfectly and works fine after expanding the groups on the client side.

I have added a snippet of how I am adding the GroupExpressions below. As well as how I'm using Group Summary Event in this scenario.

 
private void pendingWorker_RunWorkerCompleted (object sender, RunWorkerCompletedEventArgs e) {  
    try {  
        this.gridView.Rows.Clear();  
        this.gridView.MasterGridViewTemplate.GroupByExpressions.Clear();  
        if (documentData != null && documentData.Rows.Count > 0) {  
            int rowCount = 0;  
            foreach (DataRow dr in documentData.Rows) {  
                ModelObject obj = GetModelObject(dr);  
                this.gridView.Rows.AddNew();  
                PopulateRow(obj, rowCount);  
                rowCount++;  
            }  
        }  
        this.gridView.MasterGridViewTemplate.GroupByExpressions.Add("[StatusColumn] Group By [StatusColumn]");  
    } catch (Exception ex) {  
        messageToolTip1.ShowExceptionMessage(ex);  
        logger.Error(ex);  
    }  
    CleanUpLoadingWorker();  
}  
 
void OnGroupSumaryEvaluate (object sender, Telerik.WinControls.UI.GroupSummaryEvaluationEventArgs e) {  
    try {  
        if (e.FormatString.ToLower().Contains("status")) {  
            e.FormatString = "STATUS STANDING : {0}";  
            this.gridView.MasterGridViewTemplate.ExpandAllGroups();  
        }  
    } catch (Exception ex) {  
        messageToolTip1.ShowExceptionMessage(ex);  
        logger.Error(ex);  
    }  
}  


Is there a workaround here that will satisfy user requirements and have the vertical scrollbar work as expected?

Thanks

1 Answer, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 12 Nov 2009, 05:09 PM
Hi Kevin White,

Thank you for reporting this issue. I confirm that the behavior of ExpandAllGroups method is wrong in Q3 2009. I logged the issue in our bug tracking system and it will be addressed in the upcoming service pack. I also updated your Telerik points for this report.

You can work around the issue by setting the GridViewTemplate.AutoExpandGroups property to true or by calling GridElement.Update method after ExpandAllGroups:

this.gridView.GridElement.Update(GridUINotifyAction.Reset);

I hope this helps. If you have any questions, don't hesitate to ask.
 

Sincerely yours,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Kevin White
Top achievements
Rank 2
Answers by
Jack
Telerik team
Share this question
or