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.
Unfortunately, activation email could not send to your email. Please try again.

Custom Summary - summing for data that''s not in DataTable

Thread ID:





18431 Aug 31,2004 07:41 AM Sep 2,2004 10:06 AM Windows Forms 3
Tags: Grouping
Administrator [Syncfusion]
Asked On August 31, 2004 07:41 AM

This might sound like a strange request....but here goes.... I''m using Custom Summary objects which are all working very well, but now the users want a major change. ;-{ They want to include a total even if the data is not included in the DataSource. For example, if I was summing up a certain column for 5 records, the users want to apply a filter so that only 3 records are shown but still get the sum of the 5 records ;-{ I''ve noticed that ITreeTableSummary CreateSummaryMethod gets called once for each record in the data set regardless of the number of levels of grouping (which makes perfect sense) I was thinking of just adding all 5 records and then somehow hidding the 2 rows in the grid that they don''t want to see, eg: int dvIndex = dataview.Find(asset.AssetId); if (dvIndex != -1) { grid.GridTableModel.HideRows[dvIndex] = true; } Does this make any sense? Should I look at filtering? As you can imagine, any help would be very very welcome Jason

Administrator [Syncfusion]
Replied On August 31, 2004 10:46 AM

Jason, When you apply a filter then the summaries will only be calculated for the records that are displayed. This is the default behavior but I think you can change it. The following method in Recod determines the summaries that are returned for any record in the table and is called both for records that meet and do not meet filter criteria. /// public override ITreeTableSummary[] GetSummaries(Table parentTable, out bool summaryChanged) { summaryChanged = false; if (!MeetsFilterCriteria()) return parentTable.GetEmptySummaries(); else { SummaryDescriptorCollection sdc = parentTable.TableDescriptor.Summaries; return sdc.CreateSummaries(this); } } So, what you could do is derived a class from GridRecord and override this method and replace it with a simple call to return parentTable.TableDescriptor.SummariesCreateSummaries(this); Check out the GridPerf example. It shows how to derive from GridEngine, override its CreateXXX method(s) so that you can hook up your derived GridRecord class with the engine. Stefan

Administrator [Syncfusion]
Replied On September 2, 2004 05:29 AM

Stefan, Thank you very much for your help - it never fails to surprise me how extensible your grid is and the thought that''s gone into it. I did what you suggested and it''s all working great. The only problem I had was creating a filter on a boolean data column. This constructor wouldn''t filter: gridGroupingControl1.TableDescriptor.RecordFilters.Add( new RecordFilterDescriptor("[" + SELECTED + "] = true")); But this one did: RecordFilterDescriptor filter = new RecordFilterDescriptor(SELECTED, new FilterCondition( FilterCompareOperator.Equals, true)); gridGroupingControl1.TableDescriptor.RecordFilters.Add(filter); Thanks again Jason

Administrator [Syncfusion]
Replied On September 2, 2004 10:06 AM

Jason, you would have to change for "= 1" instead of "= true" in the expression string. We''ll add support for true / false keywords later. Regarding the summaries. I just ran into a similar scenario when working on FilterBar support where some summaries needed to be calculated on all available record. I now added a "IgnoreRecordFilterCriteria" property. So now you can have a mix of summaries that are calculated only for filtered records and summaries that are calculated on all records. Stefan


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.