Reolad Data in gird grouping control
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;
SIGN IN To post a reply.
3 Replies
AR
Arulpriya Ramalingam
Syncfusion Team
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
FP
franco perduca
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
AR
Arulpriya Ramalingam
Syncfusion Team
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
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
FP franco perduca
- Jun 2, 2017 01:02 PM UTC
- Jun 7, 2017 04:29 PM UTC