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.

Child tables of new rows that should be hidden are unexpectedly displaying after saving to database

Thread ID:

Created:

Updated:

Platform:

Replies:

46858 Jul 21,2006 03:59 PM Jul 25,2006 08:42 AM Windows Forms 5
loading
Tags: Grouping
Scott Mercer
Asked On July 21, 2006 03:59 PM

Hi,

OVERVIEW:
I have a GroupingGridControl that has conditionally displayed child tables implemented using a custom GridGroupingEngine that implements IGridRowHeight. The display of the child tables are determined based on a dropdown selection made in the parent row.

PROBLEM DESCRIPTION:
Unexpected behavior occurs when I create a new row at the parent level (that is supposed to have hidden child tables) and save to the database. After I save the DataSet, all child tables of the parent display regardless if their height setting. This only occurs if the parent row is expanded when saving. If I collapse and reexpand the parent node, the child tables are then painted as expected.

REPRODUCE:
Using the example project I have attached, use the following steps to reproduce this error:

1) Start the application and add a new Widget row and give it a "Widget Type" or "Toy Widget".

2) Expand the "Toy Widget" row that you just added. The "Toy Widget" should only show the "WidgetPartsList" table below. Only "Industrial Widget" should show the "WidgetMaintenanceLog" table.

3) Click on the "Save" button. This should cause the "WidgetMaintenanceLog" table to unexpectedly appear under the new Widget.

4) Collapse then re-expand the newly added Widget row. Now only the WidgetPartsList should show up under the new Widget row.

Please let me know if any clarification is needed beyond the comments within the project.

Thanks,
Scott

SaveExpandGroupingGridExample.zip

Scott Mercer
Replied On July 21, 2006 04:04 PM

I just wanted to clarify a couple of things:

In the instructions, item number (1) should read as follows:

1) Start the application and add a new Widget row and give it a "Widget Type" of "Toy Widget".

Also, I have experienced this behavior in versions 4.1.0.63 and 4.2.0.37 of Essential Studio.

--Scott

Administrator [Syncfusion]
Replied On July 24, 2006 01:56 AM

Hi Scott,

You can use this code snippet to re-expand the changed record of the GroupingGridControl. Please find the code snippet below.

////Attach the DisplayElement changing Event.
this.WidgetGroupingGrid.Table.DisplayElementChanging +=new DisplayElementChangingEventHandler(Table_DisplayElementChanging);

////insert the rows starting with the parents going down to the children breadth first
this.FakeInsertDataTable(this.WidgetData.Widget, "WidgetID");
this.FakeInsertDataTable(this.WidgetData.WidgetMaintenanceLog, "WidgetMaintenanceLogID");
this.FakeInsertDataTable(this.WidgetData.WidgetPartsList, "WidgetPartsListID");

////Deattach the DisplayElement changing Event.
this.WidgetGroupingGrid.Table.DisplayElementChanging -=new DisplayElementChangingEventHandler(Table_DisplayElementChanging);
if( rec.IsExpanded )
{
rec.IsExpanded = false;
rec.IsExpanded = true;
}

Record rec;
private void Table_DisplayElementChanging(object sender, DisplayElementChangingEventArgs e)
{
if( e.Element.ParentTableDescriptor.Name == "Widget")
rec = e.Element as Record;
}

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/SaveExpandGroupingGridExample_5698f01b.zip

Best Regards,
Haneef

Scott Mercer
Replied On July 24, 2006 05:25 PM

Haneef,

This solution does not work if you have more than one new record that is expanded. Your solution did point me in the right direction though. What you need to do is maintain an ArrayList (or Generic list in 2.0) of new Record objects that are currently expanded. After the inserts have occurred, then you have to go through every item in the ArrayList and flip its IsExpanded state to false, then back to true.

If have posted my fix if anyone is interested.

One question though. Although we have fixed the bahavior problem here, do you (Syncfusion the collective) think that the behavior I was observing is desired? Is that the way that the GridGroupingControl was designed to operate?

Thanks,
Scott

SaveExpandGroupingGridExample_solution.zip

Scott Mercer
Replied On July 24, 2006 06:04 PM

Oops! I posted the wrong file. The last message was exactly the same as Haneef''s example. This should be the correct one.

--Scott

SaveExpandGroupingGridExample_solution0.zip

Administrator [Syncfusion]
Replied On July 25, 2006 08:42 AM

Hi Scott,

Thanks for your update. I have contacted the development team regarding this issue and will be updating you soon.

Thanks for your patience.
Best Regards,
Haneef

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.

;