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.

Add child record on Datasource Update

Thread ID:

Created:

Updated:

Platform:

Replies:

116512 Jun 3,2014 04:56 PM Jun 20,2014 01:20 AM Windows Forms 7
loading
Tags: GridGroupingControl
Mark
Asked On June 3, 2014 04:56 PM

I have a GridGroupingControl that I manually add columns and relationships.  The datasource for the control is a List of custom objects as mapped by the relationships.  The problem I'm having is that when I update the underlying datasource the control is not adding the new nested child relationship record.

The underlying relationships are all using IList collections that are mapped to a database and there is little to no hope of making them BindingLists.   

Is there anyway I can force the gridgroupingcontrol to reread the datasource without it rebuilding the entire control?

Thanks,

Mark


Muthukumar Kalyanasundaram [Syncfusion]
Replied On June 8, 2014 11:51 PM

Hi Mark,

Thanks for your interest in Syncfusion products.

 

 

Query

      Add child  Record on Data Source

 

List Item Reference is an object reference relation for looking up values from a strong typed collection. You can make use of this  below UG link.

 

UG Link :

 http://help.syncfusion.com/ug/windows%20forms/grid/default.htm#!Documents/listitemreferencerel.htm

 Regards,

Muthukumar K


Mark
Replied On June 9, 2014 12:11 PM

Hi Muthukumar K,

Thanks for the response to my question, but I'm a bit confused by your response.  I have the datasource all setup and the classes with the nested relationships is working as expected.  On instantiation of the GridGroupingControl I set the AutoPopulateRelations = false and manually add all the columns and nested relationships to the control.  All that works great until I update the underlying datasource.  Since the nested classes are using IList rather than Bindinglist the GridGroupingControl has no idea that the datasource has been updated and will therefore not add a new record to the nested table when it's added to the nested IList of the sub class.

The last thing I was trying was to add the record to the GridGroupingControl nested table myself, so the control will stay in sync with the datasource, but I haven't been successfully as of yet. 

From getting the parent element I am able to obtain the parent record and from there I tried the following:

NestedTable nestedTable = record.NestedTables[0];

nestedTable.ParentTable.AddNewRecord.SetCurrent();

nestedTable.ParentTable.AddNewRecord.BeginEdit();

// Here is where things broke down because CurrentRecord is null

nestedTable.ParentTable.CurrentRecord.SetValue("ColumnName", newValue);

nestedTable.ParentTable.AddNewRecord.EndEdit();


Thanks for the help,

Mark




Muthukumar Kalyanasundaram [Syncfusion]
Replied On June 15, 2014 12:06 PM

Hi Mark,

Thanks for the update.

 

 Query

Add child  Record on Data Source

 

Grouping is a recursive process whereby a data source may be grouped several times. This leads to the recursive situation of groups having sub-groups and so on. Please you can make use of this  below UG link.

UG Link:  http://help.syncfusion.com/windows%20forms/grouping

 

 Please let us know if you have any concern.

Regards,

Muthukumar K


Mark
Replied On June 16, 2014 02:20 PM

Muthukumar K,

I read through the document link you provided, but that doesn't really tell me anything. I see how the classes interrelate, but I still have no idea how to tell the NestedTable to add the new record that is in the SourceList.

If I do the following starting from the Parent Record of the nested table:

ChildTable childTable = record.NestedTables[0].ChildTable;

int count1 = childTable.Records.Count;

int count2 = childTable.SourceList.Count;

count1 will remain fixed at the number loaded into the control from startup while count2 will continue to increment while items are added to the SourceList.

So how do I tell childTable.Records to reread it's sourceList to load the new records?


Thanks,

Mark




Neelakandan Kannan [Syncfusion]
Replied On June 17, 2014 11:39 PM

Hi Mark,

 

The reported scenario can be achieved by TableDirty Property in GridGroupingControl. If TableDirty property is set to true, the engine won't try to keep anything in synchronization at that time.

 

Please refer the below code:

 

gridGroupingControl1.SourceListListChanged += new Syncfusion.Grouping.TableListChangedEventHandler(gridGroupingControl1_SourceListListChanged);

       

void gridGroupingControl1_SourceListListChanged(object sender, Syncfusion.Grouping.TableListChangedEventArgs e)

        {

            e.Table.TableDirty = true;

        }

 

Note:

If you still have the issue in your end, Please send us your sample. It will help us to overcome the reported scenario ASAP.

 

Please let me know if you have any concerns.

 

Regards,

Neelakandan


Mark
Replied On June 18, 2014 12:42 PM

Neelakandan,

I tried your suggestion, but since my SourceList does not implement a IBindingList the event is never fired.  That being said I can get things to refresh if I set the correct nested Table to is dirty as you suggest in the event method.

So my next question is from either the record or the element what is the most efficient way to get the table that object is associated with, so I can set the TableDirty property for only that nested table?

Thanks,

Mark


Neelakandan Kannan [Syncfusion]
Replied On June 20, 2014 01:20 AM

Hi Mark,

 

Thank you for your update.

 

We have already updated solution to this query .

 

Please refer the below incident for the further details:

 

http://www.syncfusion.com/support/directtrac/incidents/126285

 

Please let me know if you have any concerns.

 

Regards,

Neelakandan


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.

;