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.
Syncfusion Feedback

Reolad Data in gird grouping control

Thread ID:

Created:

Updated:

Platform:

Replies:

130791 Jun 2,2017 01:02 PM UTC Jun 7,2017 04:29 PM UTC Windows Forms 3
loading
Tags: GridGroupingControl
franco perduca
Asked On June 2, 2017 01:02 PM UTC

Hi all
I have a gridgrouping control that load the data with code taken from your site (see below) and it works fine.
In the code I setup also some filter , hide some colums, set some other columns to read only  ecc.

Now I need to reload the data , how is possibile to achieve this and maintain the setup of grid ?
Thank you for yor support

Franco

DataTable parentTable = GetParentTable();
DataTable childTable = GetChildTable();
DataTable grandChildTable = GetGrandChildTable();
GridRelationDescriptor parentToChildRelationDescriptor = new GridRelationDescriptor();

//Same as SourceListSetEntry.Name for Child Table.
parentToChildRelationDescriptor.ChildTableName = "MyChildTable";
parentToChildRelationDescriptor.RelationKind = RelationKind.RelatedMasterDetails;
parentToChildRelationDescriptor.RelationKeys.Add("parentID", "ParentID");

//Adds relation to Parent Table.
gridGroupingControl1.TableDescriptor.Relations.Add(parentToChildRelationDescriptor);
GridRelationDescriptor childToGrandChildRelationDescriptor = new GridRelationDescriptor();

//Same as SourceListSetEntry.Name for Grand Child Table.
childToGrandChildRelationDescriptor.ChildTableName = "MyGrandChildTable";
childToGrandChildRelationDescriptor.RelationKind = RelationKind.RelatedMasterDetails;
childToGrandChildRelationDescriptor.RelationKeys.Add("childID", "ChildID");

//Adds relation to Child Table.
parentToChildRelationDescriptor.ChildTableDescriptor.Relations.Add(childToGrandChildRelationDescriptor);
this.gridGroupingControl1.Engine.SourceListSet.Add("MyParentTable", parentTable);
this.gridGroupingControl1.Engine.SourceListSet.Add("MyChildTable", childTable);
this.gridGroupingControl1.Engine.SourceListSet.Add("MyGrandChildTable", grandChildTable);

this.gridGroupingControl1.DataSource = parentTable;


Arulpriya Ramalingam [Syncfusion]
Replied On June 5, 2017 01:41 PM UTC

Hi franco, 

Thanks for using Syncfusion products. 

In GridGroupingControl, If you want the grid settings while reloading the GridGroupingControl, you need to create the separate methods for Grid(GridSettings) then use this method when reload the grid. Please refer the below code and sample, 

Code snippet 
 
public Form1() 
{ 
    InitializeComponent(); 
 
    // DataSource code// 
    
      this.GridSettings(); 
} 
 
#region Grid Settings 
public void GridSettings() 
{ 
    gridGroupingControl1.AllowProportionalColumnSizing = true; 
    //Setting the filter condition. 
    FilterCondition condition = new FilterCondition(FilterCompareOperator.GreaterThan, 50); 
    //Setting the RecordFilterDescriptor 
    RecordFilterDescriptor recordFilterDescriptor = new RecordFilterDescriptor("CategoryID", condition); 
    //Adding the RecordFilterDescriptor to collection 
    this.gridGroupingControl1.TableDescriptor.RecordFilters.Add(recordFilterDescriptor); 
   //To add the hidden columns 
    foreach (GridColumnDescriptor col in this.gridGroupingControl1.TableDescriptor.Columns) 
    { 
        if (!this.gridGroupingControl1.TableDescriptor.VisibleColumns.Contains(new GridVisibleColumnDescriptor(col.Name))) 
        { 
            this.gridGroupingControl1.TableDescriptor.VisibleColumns.Add(col.Name); 
        } 
    } 
} 
#endregion 
 
//Button click Event Customization 
private void reloadBtn_Click(object sender, EventArgs e) 
{ 
    this.gridGroupingControl1.DataSource = null; 
    this.gridGroupingControl1.DataSource = parentTable; 
    this.GridSettings(); 
} 
 
 
Regards, 
Arulpriya

franco perduca
Replied On June 6, 2017 07:46 PM UTC

Thank You for your support
Another question 

it's possible to have a filter that work only in parent grid and not in a child ? like this


Arulpriya Ramalingam [Syncfusion]
Replied On June 7, 2017 04:29 PM UTC

Hi Franco, 
 
Thanks for your update. 
 
By default the ExcelFiler have the support to filter the parent table only. The GridExcelFilter does not have the support to filter the nested table. Please refer the below UG link to know more about GridExcelFilter and dashboard sample. 
 
Dashboard sample link: <Install location>\Syncfusion\EssentialStudio\<Product version>\Windows\Grid.Grouping.Windows\Samples\Filters and Expressions\Optimized Excel Filter Demo\CS 
 
Can you please provide your requirement so that we could able to provide you a better solution at the earliest. 
 
Arulpriya 


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.

Warning Icon 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.Close Icon

;