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 rows in ridGroupingControl

Thread ID:

Created:

Updated:

Platform:

Replies:

13993 May 15,2004 06:06 AM Jun 20,2004 12:12 AM Windows Forms 18
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On May 15, 2004 06:06 AM

Is there a way to add custom (e.g., non-databound) rows to a databound GridGroupingControl? It appears that this is possible in the GDBG (follwing the GDBGMultiHeaderExample) but I haven''t been able to find a comparable example for GGC. Thank you, dan

Administrator [Syncfusion]
Replied On May 16, 2004 06:16 PM

There is a QueryCellStyleInfo event that you can use to provide values for an unbound column. To save these values back to a special datasource for your unbound values, you can use TableControlCurrentCellValdiating. Here is a little sample. GGC_QueryCellStyleInfo_2614.zip

Administrator [Syncfusion]
Replied On May 16, 2004 11:13 PM

Thanks, but I''m actually trying to add an unbound extra row up top rather than a column. Thanks.

Administrator [Syncfusion]
Replied On May 16, 2004 11:16 PM

(As the example use case, if there''s an error connecting to the server, I''d like to add an row at the top of the table with a cell covering all the columns explaining the error .)

Administrator [Syncfusion]
Replied On May 17, 2004 01:23 AM

You could show a custom caption row at this point, ie. add your error message to this existing row. And you can use QueryCellStyleInfo to conditionally provide the custom caption. There is a sample in this forum thread. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=11530

Administrator [Syncfusion]
Replied On May 17, 2004 01:40 AM

Dan, you can add additional custom sections to any group. In your specific case, you can check for group.IsTopLevelGroup in the ChildTable.OnInitializeSections method and add that extra section before all other sections. Once such an extra section class overrides the GetVisibleCount method and returns a value greater than 0 it will appear as Element in the DisplayElements collection. The DisplayElements collection is in sync with rows in the table. See attached sample. I also did handle QueryCoveredRange so that the whole row is drawn as one large covered cell. Stefan GroupCustomers_2088.zip

Administrator [Syncfusion]
Replied On May 17, 2004 07:27 AM

Thank you. I''ll try that.

Administrator [Syncfusion]
Replied On May 18, 2004 02:46 AM

It looks pretty good. I''ve got a few quick questions: 1) It seems to overwrite the header row (and makes it show a summary row which I''ve turned off for the TopLevelGroup). Is there a way around this? 2) Instead of subclassing GridEngineFactoryBase/GridEngine/ChildTable, is it safe to just call this.groupingGring.[something].Sections.Add(new ExtraSection(this)); instead so it can be added/removed at runtime? Thank you again, dan BTW: Some of these assorted samples from the forums are quite useful--you might consider including them with the samples in the distribution.

Administrator [Syncfusion]
Replied On May 18, 2004 03:27 AM

Hi Dan, 1) I am not sure I understand. Do you have steps to see the issue in the example I posted? 2) It should be safe to do that. It''s just that whenever you change the GroupedColumns collection or when the table is set "Dirty", all existing groups will be discared and reinitialized. Also, the TopLevelGroup will be reinitialized. You could listen to the CategorizedRecords event to be notified when that happened and then reinsert the section again. We try to make all those samples we post here into KB articles. Later we''ll also add some of them to the distribution. Thanks for the feedback! Stefan

Administrator [Syncfusion]
Replied On May 18, 2004 08:50 PM

> 1) I am not sure I understand. Do you have steps to see the issue in the example I posted? Yes -- it looks like it manifests itself in your example as well. The columns of the grid don''t have header cells (CustomerID, CompanyName, ContactName, ...) If you comment out the line GridEngineFactory.Factory = new GroupingEngineFactory(); the ExtraSection region obviously doesn''t show up, but the header cells are visible. Thanks again, dan

Administrator [Syncfusion]
Replied On May 20, 2004 02:21 PM

(and it seems to take up two rows worth of space, so I suspect it''s somehow covering the header)

Administrator [Syncfusion]
Replied On May 24, 2004 10:51 AM

Hi Dan, sorry for the late reply. I was travelling the last couple of days. I looked at the sample I posted above and found that I have a mistake in there: Replace the line public class GroupingChildTable : ChildTable with public class GroupingChildTable : GridChildTable That''s why the column headers did not show up in the example. Stefan

Administrator [Syncfusion]
Replied On May 25, 2004 11:11 AM

Thanks, looks great. Is there any way to put this inside the scrolling part of the grid (eg in the top-level group, under the header?) Dan

Administrator [Syncfusion]
Replied On May 25, 2004 02:27 PM

The following code let''s you the ExtraSection below the column headers and before the DetailsSection: protected override void OnInitializeSections(bool hasRecords, SortColumnDescriptorCollection fields) { base.OnInitializeSections(hasRecords, fields); EndInit(); if (this.IsTopLevelGroup) { // Search for Detailssection for (int n = 0; n < Sections.Count; n++) { Section s = this.Sections[n]; if (s is DetailsSection) { // Insert before Details InvalidateCounter(); this.Sections.Insert(n, new ExtraSection(this)); break; } } } } The EndInit is kind of "messy" here but necessary. It''s because BeginInit() is called before OnInitilizeSections. While the Sections are in BeginInit mode, you cannot get the Count or Insert. Stefan

Administrator [Syncfusion]
Replied On May 29, 2004 08:31 PM

Thank you. How do you find out when this row is selected? My guess is this: private void itemGrid_TableControlCurrentCellActivated(object sender, GridTableControlEventArgs e) { Syncfusion.Grouping.Element element = e.TableControl.Table.; if(element is ExtraSection) { ... } } but this seems to thrown a null pointer exception. Thank you again, dan

Administrator [Syncfusion]
Replied On May 29, 2004 09:18 PM

(after the dot, it reads CurrentElement, but I suppose that''s immaterial since it doesn''t work...)

Administrator [Syncfusion]
Replied On June 1, 2004 01:54 PM

Dan, only NestedTable and Record elements can become a current elements in the Table. But you can check the current cell. Instead of Syncfusion.Grouping.Element element = e.TableControl.Table.CurrentElement; if(element is ExtraSection) try Syncfusion.Grouping.Element element = e.TableControl.Table.DisplayElements[e.TableControl.CurrentCell.RowIndex]; if(element is ExtraSection) Let me know if that didn''t work. Thanks, Stefan

Administrator [Syncfusion]
Replied On June 1, 2004 09:50 PM

Works perfectly. Thanks.

Administrator [Syncfusion]
Replied On June 20, 2004 12:12 AM

Is there a way to force the table to update once I''ve added/removed an ExtraSection? I tried Refresh(), Invalidate(), etc. Thanks, dan

CONFIRMATION

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.

;