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

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

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

5 Replies

SM Scott Mercer July 21, 2006 08:04 PM UTC

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


AD Administrator Syncfusion Team July 24, 2006 05:56 AM UTC

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


SM Scott Mercer July 24, 2006 09:25 PM UTC

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


SM Scott Mercer July 24, 2006 10:04 PM UTC

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


AD Administrator Syncfusion Team July 25, 2006 12:42 PM UTC

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

Loader.
Live Chat Icon For mobile
Up arrow icon