8
Views
3
Comments
Solved
[OutSystems Data Grid] Data Grid Reactive – Duplicate Row Creates a Second Blank Row When Using Checkbox
outsystems-data-grid
Reactive icon
Forge asset by OutSystems
Application Type
Reactive

Hi everyone,

I'm trying to implement a Copy / Duplicate row feature in Data Grid Reactive.

I followed the solution from this forum post: https://www.outsystems.com/forums/discussion/72829/how-to-duplicate-data-grid-reactive-rows/

The functionality works partially:

If I manually drag and select the row (not using the checkbox), the copy happens correctly.

When I select the row using the checkbox, on selecting the first row, and then click the duplicate button, it adds just 1 row at the top, but if I select the ones below the first row, and duplicate, the grid always inserts two rows:

  • 1 correct duplicated row
  • 1 extra blank row above it

Here is my setup:

I use GetSelectedRowsData → JSON Deserialize → AddNewRows(1) → SetCellData for each column.

Debugging shows:

  • The selected rows count is 1
  • AddNewRows = 1
  • GetRowData JSON is correct

But visually the grid inserts two rows only when a checkbox is used.

Has anyone seen this behavior before?

  1. Is this a known issue/bug with AddNewRows when the row is selected via checkbox?
  2. Is there a workaround other than manually manipulating the provider collection via JavaScript?
  3. Any recommended alternative approach for duplicating a row?

Thanks in advance!

2026-01-28 16-57-48
Mihai Melencu
Champion
Solution

Hi,

I figured out the cause of the bug: it happens when the focused row is different from the row selected via the checkbox. 


The issue seems to come from the AddNewRows client action. I couldn’t determine the exact underlying reason, but I found a reliable workaround by adding the new row through JavaScript instead. 

Instead of the client action you can use the following JS snippet:

  • var grid = OutSystems.GridAPI.GridManager.GetGridById($parameters.GridWidgetId);
  • var newItem = {
  •     Id: null
  • };
  • grid.dataSource.addRow(0, [newItem]);
UserImage.jpg
Karthik Santosh

Thank you @Mihai Melencu, works perfectly fine!

Is there a way I can handle the same while sorting? If sort is enabled and then the row is duplicated, row might visually jump to a different position immediately after being added. Is there a way to handle it in a way that the added/duplicated row stays at the top of the Grid no matter what?

2026-01-28 16-57-48
Mihai Melencu
Champion

Hi,

I tried several approaches, but none worked reliably.

If you use the AddNewRows client action, you won’t be able to add rows while the grid is sorted or filtered. My recommendation is to either prevent this situation by showing an error message, or prompt the user to clear sorting/filtering before adding a new row. 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.