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
close icon

GGC :Sorting parent records and within them, child records

Is there anything special I need to do sort parent records on a parent table column and within them sort child records based on a child table column? I am using the following code but it only sorts the parent records. The child records are displayed unsorted. GridEngine engine = sfGroupDGApprovalHistory.Engine; parentTableDescriptor = (GridTableDescriptor) engine.TableDescriptor; GridRelationDescriptor parentToChildRelDesc = parentTableDescriptor.Relations["LoanApprovalStatus_LoanApprovalDetails"]; childTableDescriptor = (GridTableDescriptor) parentToChildRelDesc.ChildTableDescriptor; // Customize Parent Columns parentTableDescriptor.Columns.Clear(); parentTableDescriptor.SortedColumns.Clear(); parentTableDescriptor.Columns.Add("ApprovalState", "ApprovalState"); parentTableDescriptor.Columns["ApprovalState"].HeaderText = "Approval State"; parentTableDescriptor.Columns["ApprovalState"].Width = 150; parentTableDescriptor.Columns.Add("SubmittedDate", "SubmittedDate"); parentTableDescriptor.Columns["SubmittedDate"].HeaderText = "Submitted Date"; parentTableDescriptor.Columns["SubmittedDate"].Width = 115; parentTableDescriptor.Columns.Add("OutcomeType", "OutcomeType"); parentTableDescriptor.Columns["OutcomeType"].HeaderText = "Outcome"; parentTableDescriptor.Columns["OutcomeType"].Width = 150; parentTableDescriptor.Columns.Add("CompletionDate", "CompletionDate"); parentTableDescriptor.Columns["CompletionDate"].HeaderText = "Decision Date"; parentTableDescriptor.Columns["CompletionDate"].Width = 100; parentTableDescriptor.Columns.Add("Remarks", "Remarks"); parentTableDescriptor.Columns["Remarks"].HeaderText = "Remarks"; parentTableDescriptor.Columns["Remarks"].Width = 200; // Add sort column for parent table parentTableDescriptor.SortedColumns.Add("SubmittedDate", System.ComponentModel.ListSortDirection.Descending); // Customize Child Columns childTableDescriptor.Columns.Clear(); childTableDescriptor.SortedColumns.Clear(); childTableDescriptor.Columns.Add("Name", "Name"); childTableDescriptor.Columns["Name"].HeaderText = "Name"; childTableDescriptor.Columns["Name"].Width = 90; childTableDescriptor.Columns.Add("CompletionDate_Nested", "CompletionDate"); childTableDescriptor.Columns["CompletionDate_Nested"].HeaderText = "Decision Date"; childTableDescriptor.Columns["CompletionDate_Nested"].Width = 115; childTableDescriptor.Columns.Add("OutcomeType_Nested", "OutcomeType"); childTableDescriptor.Columns["OutcomeType_Nested"].HeaderText = "Outcome"; childTableDescriptor.Columns["OutcomeType_Nested"].Width = 150; childTableDescriptor.Columns.Add("Remarks_Nested", "Remarks"); childTableDescriptor.Columns["Remarks_Nested"].HeaderText = "Remarks"; childTableDescriptor.Columns["Remarks_Nested"].Width= 200; // Add sort column for child table childTableDescriptor.SortedColumns.Add("CompletionDate_Nested", System.ComponentModel.ListSortDirection.Descending); Is there anything wrong I am doing? Regards Anupama

5 Replies

AD Administrator Syncfusion Team April 19, 2006 08:41 AM UTC

Hi Anupama, We tried to reproduce this issue in 4.1, but could not get this issue. Maybe I am not following the steps that you are doing. Your sample code works fine here. Can you post a small sample showing this problem or tell us how to see it in the Attached sample? Here is a sample http://www.syncfusion.com/Support/user/uploads/Nested_GGC_1091e75.zip Exactly what version of Windows XP are you using? Are you only installing Essential Grid or are you installing Essential Studio? Are you installing binaries only, or the source code version? Have you seen this on multipple systems? If you provide the more information, we can try to suggest some solution. Thanks for your patience. Regrads Haneef


AN Anupama April 19, 2006 09:58 AM UTC

Hi Haneef, I am sending you the relevant screenshots. The first picture shows how the parent records have been sorted based on the ''Submitted Date'' column. The second picture shows that the nested child records have not been sorted based on the ''Decision Date'' column. I am using Syncfusion ver 3.2.1.0. I have installed the entire studio source code version. I am using Windows XP Professional SP2. I have not yet tested this on multiple systems. Can you see what could be the problem from the screenshots? It will take me a while to reproduce this on another project. I wont be able to send you the original project as it is a huge application with a lot of other dependencies. Thanks Anupama >Hi Anupama, > >We tried to reproduce this issue in 4.1, but could not get this issue. Maybe I am not following the steps that you are doing. Your sample code works fine here. Can you post a small sample showing this problem or tell us how to see it in the Attached sample? > >Here is a sample >http://www.syncfusion.com/Support/user/uploads/Nested_GGC_1091e75.zip > >Exactly what version of Windows XP are you using? > >Are you only installing Essential Grid or are you installing Essential Studio? Are you installing binaries only, or the source code version? > >Have you seen this on multipple systems? > >If you provide the more information, we can try to suggest some solution. > >Thanks for your patience. >Regrads >Haneef

Screenshots8.zip


AD Administrator Syncfusion Team April 19, 2006 11:04 AM UTC

Hi Anupama, Sortedcolumns''s Add method takes the mapping name of the bound column as first argument. It will not accept the HeaderText/Name of the bound column as first argument.Please try this code // Add sort column for child table childTableDescriptor.SortedColumns.Add("CompletionDate", System.ComponentModel.ListSortDirection.Descending); Let me know if this helps. Regards, Haneef


AN Anupama April 20, 2006 04:54 AM UTC

Haneef, Thanks! That worked! However its not very obvious that SortedColumns.Add expects the mapping name rather than the grid column name. Does this apply to GroupedColumns, VisibleColumns and other such collections as well? Thanks for your help! -Anupama


AD Administrator Syncfusion Team April 21, 2006 04:28 AM UTC

Hi Anupama, Thanks for your update. Yes.The same logic applies to GroupedColumns and VisibleColumns collection. Please let me know if this helps. Regards, Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon