We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Grouping summary not updating when dataview changes

Hi, I have created 2 additional columns to my grid, each with grouping summaries and the grouping summaries are not updating when the underlying data in the dataview changes. =========================== GridTableDescriptor gtd = this.linkMonitorGrid.TableDescriptor; gtd.Columns.Add("TechnicalStatus"); gtd.Columns.Add("IOMSupportLink"); ExpressionFieldDescriptor exField; exField = new ExpressionFieldDescriptor("TechnicalStatus"); exField.Expression = "[Status] in {2,3}"; exField.ResultType = "int"; gtd.ExpressionFields.Add(exField); exField = new ExpressionFieldDescriptor("IOMSupportLink"); exField.Expression = "[Status] in {1,3}"; exField.ResultType = "int"; gtd.ExpressionFields.Add(exField); =========================== The expression columns change just fine, but the grouping summaries don''t. Please any assistance? Do I need to update them manually?? Jason.

5 Replies

JS Jason Southgate October 13, 2004 08:07 AM UTC

Here is the code for the summaries... ============================ // set up summaries GridSummaryColumnDescriptor[] sumCols = new GridSummaryColumnDescriptor[2]; totalSum = new GridSummaryColumnDescriptor("TechnicalStatus"); totalSum.SummaryType = SummaryType.DistinctCount; totalSum.Format = "{Count:#}"; totalSum.Style = GridSummaryStyle.Column; totalSum.DataMember = "TechnicalStatus"; totalSum.Appearance.GroupCaptionSummaryCell.HorizontalAlignment = GridHorizontalAlignment.Center; totalSum.Appearance.GroupCaptionSummaryCell.Font.Bold=true; totalSum.DisplayColumn = "TechnicalStatus"; sumCols[0] = totalSum; totalSum = new GridSummaryColumnDescriptor("IOMSupportLink"); totalSum.SummaryType = SummaryType.DistinctCount; totalSum.Format = "{Count:#}"; totalSum.Style = GridSummaryStyle.Column; totalSum.DataMember = "IOMSupportLink"; totalSum.Appearance.GroupCaptionSummaryCell.HorizontalAlignment = GridHorizontalAlignment.Center; totalSum.Appearance.GroupCaptionSummaryCell.Font.Bold=true; totalSum.DisplayColumn = "IOMSupportLink"; sumCols[2] = totalSum; GridSummaryRowDescriptor sRow = new GridSummaryRowDescriptor("Totals", sumCols); gtd.SummaryRows.Insert( 0, sRow ); sRow.Visible = false; // don''t show the row normally, just use the caption summary gtd.ChildGroupOptions.ShowCaptionSummaryCells = true; ============================


AD Administrator Syncfusion Team October 13, 2004 03:55 PM UTC

The grid handles IBindingList.ListChanged events and will call InvalidateSummariesBottomUp so that the summaries get reevaluated. This seems to work fine with GroupCustomer, so it may be something specific with your code. A complete sample that shows the problem would help a lot. Below is another sample where this seems to work as expected. Maybe you could change it to show the problem. GGCsummaries_1839.zip


JS Jason Southgate October 15, 2004 01:38 PM UTC

Hello Clay, Well I can''t get to the bottom of this one so easily. I currently am using a dataview and I''m listening to the ListChanged event, trying to force the grid manually to invalidate and refresh these summary captions correctly. Can you suggest which exact method to call so I can refresh these captions? ============================== /// /// Handles the event that gets fired when the data underlying the grid changes. /// /// The object that causes the event to be fired. /// The arguments for the event. private void OnLinkViewChanged ( object sender, ListChangedEventArgs e ) { // if it''s an addition or an update if ( e.ListChangedType == ListChangedType.ItemAdded || e.ListChangedType == ListChangedType.ItemChanged) { CheckForPossibleGridExpands( e.NewIndex ); } if ( e.ListChangedType == ListChangedType.Reset ) { this.linkMonitorGrid.TableModel.Table.InvalidateSummariesBottomUp(); //? this one doesn''t work this.linkMonitorGrid.Invalidate(); } //? neither does this } ============================== Thanks, Jason.


JS Jason Southgate October 15, 2004 01:49 PM UTC

GGCsummaries_729.zip Here''s the interface to give you an idea of the "scope" of the problem, but since I''m limited by the DataView providing the data, which in fact is a inherited from a System.Data.DataView, and it''s the way it''s binding my guess that''s causing this incompatibility. This code works just fine. Can''t send over a lot of copyright code, so I guess it''s better if I force it to invalidate and refresh these captions manually. GGCsummaries_7312.zip


AD Administrator Syncfusion Team October 15, 2004 02:57 PM UTC

Try calling this.gridGroupingControl1.Table.SummariesDirty = true; this.gridGroupingControl1.Refresh(); to see if this handles the problem.

Loader.
Live Chat Icon For mobile
Up arrow icon