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

Left/Right arrow keys not saving cell value, only UP/Down key does

entering value in the ggc and pressing the left or right arrow key does not save data, only up/down arrow key works. Cell value revert back to original.

I have this code that I saw in this forum, but it's still not working.

void gridGroupingControl1_CurrentRecordContextChange(object sender, CurrentRecordContextChangeEventArgs e)
{
if (e.Action == CurrentRecordAction.CurrentFieldChanged)
{
this.gridGroupingControl1.CurrencyManager.EndCurrentEdit();
this.gridGroupingControl1.Table.InvalidateSummary();
}
}

5 Replies

AD Administrator Syncfusion Team December 14, 2006 09:50 AM UTC

Hi James,

Thank you for being patience.

In your code snippet (grid Settings), we could see the use of TableControlCurrentCellKeyDown event which may be the cause of this issue. Please upload us the code snippet on this event, so we could suggest you a better solution
>>>>>>>>>>>
// FIX - > Enable LEFT/RIGHT arrow movement across caption row
this.gridGroupingControl1.TableControlCurrentCellKeyDown += new Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlKeyEventHandler(this.gridGroupingControl1_TableControlCurrentCellKeyDown);
>>>>>>>>>>>

Note: For grid settings code snippet, refer to the following forum thread
http://www.syncfusion.com/support/forums/message.aspx?&MessageID=53189

Best regards,
Madhan


JB James Blibo December 15, 2006 04:59 PM UTC

private void gridGroupingControl1_TableControlCurrentCellKeyDown(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlKeyEventArgs e)
{
GridCurrentCell cc = e.TableControl.CurrentCell;
GridTableCellStyleInfo style = cc.Renderer.CurrentStyle as GridTableCellStyleInfo;
if (style != null)
{
if (style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionSummaryCell)
{
e.TableControl.ForceCurrentCellMoveTo = true;

switch (e.Inner.KeyData)
{
case Keys.Right:
cc.MoveTo(cc.RowIndex, cc.ColIndex + 1, GridSetCurrentCellOptions.SetFocus);
e.Inner.Handled = true;
break;
case Keys.Left:
cc.MoveTo(cc.RowIndex, cc.ColIndex - 1, GridSetCurrentCellOptions.SetFocus);
e.Inner.Handled = true;
break;
}
}
}



}


AD Administrator Syncfusion Team December 18, 2006 09:58 AM UTC

Hi James,

The reason for the value not being updated is because of the CurrentRecordContextChange event in your code snippet. In the event, the call to EndCurrentEdit method cancels the cell value being saved to the datasource on Left / Right key down.

The following code snippet helps to update the summary row value on record value being changed.
>>>>>>>>>>>>>>>
// CurrentRecordContextChange
if (e.Action == CurrentRecordAction.EndEditComplete)
{
e.Record.InvalidateCounterBottomUp();
this.gridGroupingControl1.Refresh();
}
>>>>>>>>>>>>>>>

Kindly let us know if you need any further assistance.
Have a nice day.

Best regards,
Madhan


JB James Blibo December 21, 2006 12:53 AM UTC

The problem is still not solve!

When I entered a value into the cell and press the LEFT or RIGHT arrow key, your solution is now correctly accepting the result (previously the cell was reverting back to its original value). However, my custom summary rows arfe not updating except I navigate to the next row using the UP/DOWN arrow key.

The UP/DOWN arrow key works perfect. When I enter a value into the cell and use the UP/DOWN arrow key to go to the next cell, the previous cell accepts the value and the summary updates immediately. It's only the LEFT/RIGHT arrow ket that I am having problem with.


What I am trying to do is to have the cell and summary values update IMMEDIATELY when i navigate to the next cell either using the UP/DOWN or LEFT/RIGHT arrow key.

I would also like to use the LEFT/RIGHT key to go across the Caption cell.

My ggc has a flat datasource thast is grouped my one field.


AD Administrator Syncfusion Team December 21, 2006 06:37 AM UTC

Hi James,

Thanks for your response. The GridGroupingControl is designed to save the updated record to dataset, when the user moves to any other record and accordingly the summary gets recalculated.

Please try the following code snippet to update the summary value, when the current field value is changed.

>>>>>>>>>>>>>>>>>>>Code Snippet 1<<<<<<<<<<<<<<<<<<<<<<
void gridGroupingControl1_CurrentRecordContextChange(object sender, CurrentRecordContextChangeEventArgs e)
{
if (e.Action == CurrentRecordAction.CurrentFieldChanged )
{
e.Record.InvalidateCounterBottomUp();
e.Table.SummariesDirty = true;
this.gridGroupingControl1.Refresh();
}
}
>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<

Kindly let us know if you need any further assistance.

Best regards,
Madhan

Loader.
Live Chat Icon For mobile
Up arrow icon