Insert new record in specific index, between records, by custom ContextMenuClick in BatchEdit Grid.

I am trying to make a BatchEdit grid (EJ2) with a specified order with a hidden field (i am trying to manage the order of the lines with a 'Order' field). So i will have to manage the value of the 'Order' field, by calculating the 'order' field using the values from the row above and below.
Now i want to insert a new record in a specific index, but i can't. It always insert into the top or the bottom of all records. I know that there are options in the Grid, .NewRowPosition(NewRowPosition.Bottom or NewRowPosition.Top), but i dont want any of them. I want to insert above selected line.
In this image, i have a custom ContextMenuItem which says 'Insert line' and i want to create the new record above the selected line, in this case between the lines which says 'second' and 'third'.


1 Reply 1 reply marked as answer

RS Rajapandiyan Settu Syncfusion Team April 5, 2021 09:35 AM UTC

Hi Emiliano, 
  
Thanks for contacting Syncfusion support. 
  
Query:  i want to insert a new record in a specific index. 
  
By default in EJ2 Grid editing, the newly added row element will be added in the DOM virtually (i.e) which will not reflected to the gridRows. When we save the newly added record then only it will be reflected to the gridRows, so it is not feasible to insert the newly added row element under the selected row.  
  
Regards, 
Rajapandiyan S 


Marked as answer
Loader.
Up arrow icon