How to add new row in SFDatagrid ??
I do not want it then appears as if it had been added ,
I want to add a new row pressed as the new row is added and then appears the option to add another rowThank you for contacting Syncfusion support.
We have analyzed your query.
You can able to add the new row continuously without moving the Selection to another row by using the
CurrentCellActivated Event like below,
C#:
|
private void datagrid_CurrentCellActivated(object sender, CurrentCellActivatedEventArgs args) { bool needToMove = (datagrid.IsAddNewIndex(args.PreviousRowColumnIndex.RowIndex) && !datagrid.IsAddNewIndex(args.CurrentRowColumnIndex.RowIndex) && (Keyboard.IsKeyDown(Key.Enter) || Keyboard.IsKeyDown(Key.Tab))); Dispatcher.BeginInvoke(new Action(() => { var gridModel = this.datagrid.GetGridModel(); var columnIndex = this.datagrid.GetFirstColumnIndex(); if (needToMove && gridModel != null) { this.datagrid.MoveCurrentCell(new RowColumnIndex(gridModel.AddNewRowController.GetAddNewRowIndex(), columnIndex)); } }), DispatcherPriority.ApplicationIdle); |
In above code snippet, we have considered the Enter and Tab key to restrict the Selection to another row while adding new row. If you did a mouse interaction or arrow keys other than Enter and Tab key if the current Selection is in AddNewRowControl, you can able to switch another row from AddNewRow position.
We have also prepared the sample for this requirement and you can download the sample from following location,
Sample:
http://www.syncfusion.com/downloads/support/forum/120968/ze/addnew_row344184716
Please let us know if you have any further assistance
Regards
Ayyanar
Hi Luis,
Thank you for the update . Regards Ayyanar
Please let us know if you need further assistance on this.
- 3 Replies
- 2 Participants
-
LF Luis Fernando
- Oct 29, 2015 10:28 PM UTC
- Nov 2, 2015 09:17 AM UTC