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.

Customizing CaptionText in GroupingGrid

Thread ID:





19716 Oct 1,2004 09:26 AM Oct 3,2004 07:39 PM Windows Forms 3
Tags: GridControl
Adam Miller
Asked On October 1, 2004 09:26 AM

I''d like to use the {Category} descriptor for filling in the CaptionText in the GroupingGrid. However, my datasource is not a DataTable. I have a custom datasource where I''ve adapted IBindingList to handle dynamic updates. Some of the column values need to be translated via a lookup table. The display vales for cells are handled via: QueryCellStyleInfo like so: if( e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell ) { if( e.TableCellIdentity.Column != null && HaveTranslation( e.TableCellIdentity.Column.MappingName )) { GridRecord record = (GridRecord) e.TableCellIdentity.DisplayElement.ParentRecord; object fieldValue = record.GetValue( e.TableCellIdentity.Column.MappingName ); e.Style.CellValue = TranslateFromValue( null, e.TableCellIdentity.Column.MappingName, fieldValue ); e.Style.TextAlign = GridTextAlign.Left; } } When I group by one of these translated columns, the group header shows {Category} as the un-translated value. Is there a way to also provide a lookup when this is drawn ?

Administrator [Syncfusion]
Replied On October 1, 2004 01:45 PM

Hi Adam, In QueryCellInfo you can check for e.TableCellIdentity.TableCellType == GridTableCellType.GridTableCellType.GroupCaptionCell and set the text that should be shown for the caption bar. Stefan

Adam Miller
Replied On October 1, 2004 03:14 PM

Stefan, that''s not working. What I''m doing is: mGroupingGrid.TableDescriptor.ChildGroupOptions.CaptionText = "{CategoryName}: {Category}"; When I group by a column whose value is translated, CaptionText shows the untranslated value. My DataSource has a Column --> Client. In the source Client has numerical values. I want to display the Client''s name. This is retreived from a lookup table, via the code I posted above int the QueryCellStyleInfo handler. So, my group captions are showing: Client: 1 Client: 2 Instead of: Client: Foo Client: Bar If there''s a way to provide this field in the SummaryRow itself where it''s normal column position is, that would be great also. My SummaryRow looks like this: GridSummaryRowDescriptor totals = new GridSummaryRowDescriptor("Totals", new GridSummaryColumnDescriptor[] { new GridSummaryColumnDescriptor("OrderedShares", SummaryType.Int32Aggregate, "OrderedShares", "{Sum}"), new GridSummaryColumnDescriptor("ExecutedShares", SummaryType.Int32Aggregate, "ExecutedShares", "{Sum}"), new GridSummaryColumnDescriptor("NumOrders", SummaryType.Int32Aggregate, "NumOrders", "{Sum}"), new GridSummaryColumnDescriptor("NumFills", SummaryType.Int32Aggregate, "NumFills", "{Sum}"), new GridSummaryColumnDescriptor("TotalValue", SummaryType.DoubleAggregate, "TotalValue", "{Sum}") } ); Then added to the grid as so: totals.Visible = true; mGroupingGrid.TableDescriptor.SummaryRows.Add( totals ); mGroupingGrid.TableDescriptor.ChildGroupOptions.ShowCaptionSummaryCells = true; mGroupingGrid.TableDescriptor.ChildGroupOptions.CaptionText = "{CategoryName}: {Category}"; mGroupingGrid.TableDescriptor.ChildGroupOptions.CaptionSummaryRow = "Totals";

Administrator [Syncfusion]
Replied On October 3, 2004 07:39 PM

Hi Adam, sorry for the late reply. Attached find a sample that adds a unbound field to do the mapping. You can group by this unbound field and at the same time hide it in your columns collecion. The sample also handles QueryCoveredRange and disables the covering for the TopLevelGroup caption and has some comments what you should do in QueryCellStyleInfo. Stefan UnboundField_1932.zip


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.