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

Retrieve records of child table grouped by GroupedColumns

Hello,
I have parent-child relationship in GGC. I have added a grouped column by which the relationship is showed in GGC.
I want to retrieve all records of grouped column when I double click on that grouped column.
I used GridTableModel, GridTableCellStyleInfo,GridTableCellStyleInfoIdentity to fetch records,but when I double clicked on grouped column, it gives null records.
Please give me any solution regarding to this.

Thank you and regards,
Rasika


5 Replies

AK Adhikesevan Kothandaraman Syncfusion Team August 28, 2015 01:21 AM UTC

Hi Rasika,

Thank you for your interest in Syncfusion products.

We have analyzed your reported scenario at our end. As per your scenario you are getting the records through GridTableCellIdentity. Instead of using that you can use the grid.Table.TopLevelControl.Groups to get the records from the groups. It will retrieve the records based on the grouped levels. Please refer the below codeSnippet,

Code Snippet:

//To get all the records of the group

string data = "";

for (int i = 0; i < this.gridGroupingControl1.Table.TopLevelGroup.Groups.Count; i++)

{

   for(int j=0;j<this.gridGroupingControl1.Table.TopLevelGroup.Groups[i].Records.Count;j++)

   {

       data = this.gridGroupingControl1.Table.TopLevelGroup.Groups[i].Records[j].ToString()+"";

   }
}

If the TopLevelGroup.Groups has the nested group then the records collection is available in the inner group of the Groups collection that is Groups[Index].Groups[InnerGroupIndex].Records has the record values.


Please let me know if you have any concern.

Regards,
Adhi.



RA Rasika August 28, 2015 05:44 AM UTC

Hello,
Thank you for reply.
But in my application I got this.gridGroupingControl1.Table.TopLevelGroup.Groups.Count = 0
So it finishes the for loop.
I have added grouped column 'Year' using following code. 
GGC.TableDescriptor.Relations[0].ChildTableDescriptor.GroupedColumns.Add("Year");
I am attaching 2 image files of my GGC. Please find the attachments.
In first image I want to double click on any of the year row.
If suppose I clicked on 'Year 2012' row then I want to fetch 9 records of that year as shown in the second image.
Please suggest any solution for this.

Thank you and regards,
Rasika

Attachment: GGC_ScreenShots_13e5a863.rar


AK Adhikesevan Kothandaraman Syncfusion Team August 31, 2015 11:07 AM UTC

Hi Rasika,

Thank you for your update.

We have analyzed your query at our end. If you want to get the records of the groups based on double click on the cell, you can achieve it by using the element.ParentGroup.Records. Please refer the below code example,,

Code Example:

GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex);
Element el = style.TableCellIdentity.DisplayElement;
if (el != null)
{
string s = "";
foreach (Record rec in el.ParentGroup.Records)
{
//Retrieves the Records of the parent group
s += rec.ToString() + Environment.NewLine;
}
//Shows the Content in the MessageBox
MessageBox.Show(s);
}

Sample:
http://www.syncfusion.com/downloads/support/forum/120043/ze/ChildGroup-2057188902

Regards,
Adhi


RA Rasika September 1, 2015 09:52 AM UTC

Hello,
Thank you for reply.It works.
Thank you so much.

Regards,
Rasika


RP Ranjani Prabhakaran Syncfusion Team September 2, 2015 12:26 PM UTC

Hi Rasika,
 
Thanks for the update.
 
Please let us know if you need any assistance.
 
Regards,
 
Ranjani

Loader.
Live Chat Icon For mobile
Up arrow icon