Hi Josip,
Thanks for using Syncfusion products.
In GridGroupingControl, by default, the modified cellvalues will be saved or committed automatically, when the current cell loses its focus or press the enter key. As per your requirement, to save the changes in a button click, CurrentCell.EndEdit() method can be used. Please make use of the below code and sample,
Code Example
|
private void Edit_Click(object sender, EventArgs e)
{
this.grid.TableControl.CurrentCell.EndEdit();
} |
Please let us know if you have any other queries.
Regards,
Sindhu
Unfortunately, this doesn't work..
Here is my grid setup:
gridNarucivanje.TopLevelGroupOptions.ShowFilterBar = true;
filter.WireGrid(gridNarucivanje);
GridExcelFilter gridExcelFilter = new GridExcelFilter();
gridExcelFilter.EnableDateFilter = true;
gridExcelFilter.WireGrid(this.gridNarucivanje);
gridNarucivanje.TableOptions.AllowSelection = Syncfusion.Windows.Forms.Grid.GridSelectionFlags.None;
gridNarucivanje.TableOptions.ListBoxSelectionMode = SelectionMode.One;
gridNarucivanje.AllowProportionalColumnSizing = true;
gridNarucivanje.ActivateCurrentCellBehavior = GridCellActivateAction.DblClickOnCell;
gridNarucivanje.TableOptions.AllowSelection = Syncfusion.Windows.Forms.Grid.GridSelectionFlags.None;
gridNarucivanje.TableOptions.ListBoxSelectionMode = SelectionMode.One;
gridNarucivanje.AllowProportionalColumnSizing = true;
this.gridNarucivanje.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails = false;
this.gridNarucivanje.TopLevelGroupOptions.ShowCaption = false;
parentToChildRelationDescriptor = new GridRelationDescriptor();
parentToChildRelationDescriptor.ChildTableName = "Stavke"; // same as SourceListSetEntry.Name for childTable (see below)
parentToChildRelationDescriptor.ChildTableDescriptor.TableOptions.ShowTableIndent = true;
parentToChildRelationDescriptor.ChildTableDescriptor.AllowEdit = true;
parentToChildRelationDescriptor.ChildTableDescriptor.AllowNew = true;
parentToChildRelationDescriptor.RelationKind = RelationKind.RelatedMasterDetails;
parentToChildRelationDescriptor.RelationKeys.Add("UIDNarudzba", "UIDNarudzba");
parentToChildRelationDescriptor.ChildTableDescriptor.Columns.Add("Opis", "Opis");
parentToChildRelationDescriptor.ChildTableDescriptor.Columns.Add("Količina", "Kolicina");
parentToChildRelationDescriptor.ChildTableDescriptor.Columns.Add("Naručeno", "Naruceno");
parentToChildRelationDescriptor.ChildTableDescriptor.Columns.Add("Isporučeno", "Isporuceno");
parentToChildRelationDescriptor.ChildTableDescriptor.Columns[0].HeaderText = "Opis";
parentToChildRelationDescriptor.ChildTableDescriptor.Columns[1].HeaderText = "Količina";
parentToChildRelationDescriptor.ChildTableDescriptor.Columns[2].HeaderText = "Naručeno";
parentToChildRelationDescriptor.ChildTableDescriptor.Columns[2].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.CheckBox;
parentToChildRelationDescriptor.ChildTableDescriptor.Columns[2].Appearance.AnyRecordFieldCell.CellValueType = typeof(int);
parentToChildRelationDescriptor.ChildTableDescriptor.Columns[2].Appearance.AnyRecordFieldCell.ValueMember = "Naruceno";
parentToChildRelationDescriptor.ChildTableDescriptor.Columns[2].Appearance.AnyRecordFieldCell.CheckBoxOptions.CheckedValue = "1";
parentToChildRelationDescriptor.ChildTableDescriptor.Columns[2].Appearance.AnyRecordFieldCell.CheckBoxOptions.UncheckedValue = "0";
parentToChildRelationDescriptor.ChildTableDescriptor.Columns[3].HeaderText = "Isporučeno";
parentToChildRelationDescriptor.ChildTableDescriptor.Columns[3].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.CheckBox;
parentToChildRelationDescriptor.ChildTableDescriptor.Columns[3].Appearance.AnyRecordFieldCell.CellValueType = typeof(int);
parentToChildRelationDescriptor.ChildTableDescriptor.Columns[3].Appearance.AnyRecordFieldCell.ValueMember = "Isporuceno";
parentToChildRelationDescriptor.ChildTableDescriptor.Columns[3].Appearance.AnyRecordFieldCell.CheckBoxOptions.CheckedValue = "1";
parentToChildRelationDescriptor.ChildTableDescriptor.Columns[3].Appearance.AnyRecordFieldCell.CheckBoxOptions.UncheckedValue = "0";
parentToChildRelationDescriptor.ChildTableDescriptor.ChildGroupOptions.ShowCaption = true;
parentToChildRelationDescriptor.ChildTableDescriptor.AllowEdit = true;
parentToChildRelationDescriptor.ChildTableDescriptor.AllowNew = true;
parentToChildRelationDescriptor.ChildTableDescriptor.AllowRemove = true;
gridNarucivanje.TableDescriptor.Relations.Add(parentToChildRelationDescriptor);
gridNarucivanje.Engine.SourceListSet.Add("MyParentTable", new cDB().dbGetTable(sql_1, "MyParentTable"));
gridNarucivanje.Engine.SourceListSet.Add("Stavke", bnd.GetData(sql_2));
this.gridNarucivanje.DataSource = new cDB().dbGetTable(sql_1, "MyParentTable");
For automatic applying changes I was previously using:
this.gridNarucivanje.Table.EndEdit();