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

How to add new row in SFDatagrid ??

pressed as add new row , 
I want to completely add , 
without the need to switch to another row so
 that it can carry out the addition of the new row.??

OR

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 row

3 Replies

AS Ayyanar Sasi Kumar Jeyaraj Syncfusion Team October 30, 2015 02:00 PM UTC

Hi Luis,

Thank 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


LF Luis Fernando October 30, 2015 04:27 PM UTC

thanks for help


AS Ayyanar Sasi Kumar Jeyaraj Syncfusion Team November 2, 2015 09:17 AM UTC

Hi Luis,

Thank you for the update .


Please let us know if you need further assistance on this.

 

Regards

Ayyanar



Loader.
Live Chat Icon For mobile
Up arrow icon