|
Query |
Solution | |
|
I want GridDateTimeColumn in edit mode on page load & Add new row event |
This can be achieved by moving the current cell to the required cell using SfDataGrid.MoveToCurrentCell method within the Form.Shown event and the SfDataGrid.AddNewRowInitiating event. Please refer to the following code example.
| |
|
When editing column it should in dd-MM-yyyy format |
To change the format for the DateTimeColumn in editing, set value for the GridDateTimeColumn.Pattern property as DateTimePattern.Custom and set the desired format using Format Property. Please refer to the following code example.
Code Example:
| |
|
After editing date when I press tab key Date is not saved it is reverted to default date, how to save it on tab key |
We can able to reproduce the reported scenario in our end. We will fix this issue in our 2018 volume 3 release, which is expected to be rolled out in the end of September, 2018. | |
|
When I use CommitNewRow function on Row Initiating Event it is adding an extra row to SFDataGrid. |
We have analyzed this reported scenario. By default, when the focus is moved from AddNewRow to any other row, the AddNewRow value will be committed to the view. This is the expected behavior. Currently we don’t have support to cancel adding new row within the AddNewRowInitiating event. We have logged this requirement as a feature request in our database and we have planned to implement this in our 2018 Volume 3 release, which is expected to be rolled out in the end of September, 2018. | |
|
I need to skip 2 columns from tab event.(i.e. When is press tab key on column 1, cursor should be moved to column 4) |
SfDataGrid doesn’t have direct support to skip the tab key navigation for any specific columns. But this can be achieved by moving the current cell to the required column when pressing tab key on the current cell by handling the SfDataGrid.TableControl.KeyDown event. Please refer to the below code example.
Code Example :
|
|
this.sfDataGrid.TableControl.KeyDown += TableControl_KeyDown;
void TableControl_KeyDown(object sender, KeyEventArgs e)
{
//To skip tab key navigation for two columns.
if (this.sfDataGrid.CurrentCell.ColumnIndex == 1 && e.KeyCode == Keys.Tab && !e.Shift)
{
e.Handled = true;
this.sfDataGrid.MoveToCurrentCell(new RowColumnIndex(this.sfDataGrid.CurrentCell.RowIndex, 4));
}
//To skip shift + tab key navigation for two columns.
else if (this.sfDataGrid.CurrentCell.ColumnIndex == 4 && e.KeyCode == Keys.Tab && e.Shift)
{
e.Handled = true;
this.sfDataGrid.MoveToCurrentCell(new RowColumnIndex(this.sfDataGrid.CurrentCell.RowIndex, 1));
}
} |
|
this.sfDataGrid.TableControl.KeyDown += TableControl_KeyDown;
void TableControl_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Tab)
{
e.Handled = true;
this.sfDataGrid.CurrentCell.BeginEdit();
}
} |