Post Closed
526
Views
4
Comments
Solved
[OutSystems Data Grid Web] How can i create button with Insert New Row function of DatGrid.
outsystems-data-grid-web
Web icon
Forge asset by OutSystems

Hello,

I know DataGrid have the InsertNewRow function when you right-click on the table, but i need to add button with the same functionality and i can´t figure it out. Hope you can help me

Thank you.

2020-08-31 15-57-57
Tiago Miguel Pereira
Staff
Solution

Hello Koya,

You can achieve that by setting into the parameters the structure that you want.
Please check the following example:

GridOS.ExternalAPI.addRow({PO_No: 'Ronaldo', Quantity: 15}, 0, GridOS.GridObject[0].gridId)

Thank you for your question. 

Tiago Pereira

2021-09-10 14-03-53
Salman Ansari

Oleksandr Danilov wrote:

Hello,

I know DataGrid have the InsertNewRow function when you right-click on the table, but i need to add button with the same functionality and i can´t figure it out. Hope you can help me

Thank you.


Hi Danilov,

I dont think you can achieve this by DataGrid component.
You have to customize in your case

2020-11-26 09-30-54
Ricardo Valim

Hi Oleksandr Danilov,

You can achieve this by our ExternalAPI, to add new rows use the method bellow:

GridOS.ExternalAPI.addRow({}, 0, '" + Grid.Id + "');

Parameters:

  • 1st: Datasource for the new row, in this case I pass a blank source
  • 2nd: the Index on where the new row will be placed
  • 3rd: The Id of the Grid, as you can have more than one grid on the same page you need to specify the which Grid you want to handle 

There is a sample attached, hope it can help you achieve your goals.

Regards

Ricardo Valim


 

DataGridButtonAddRow.oml
UserImage.jpg
Koya Kojima

What should I do if I want to set a value for the first Parameter?

2020-08-31 15-57-57
Tiago Miguel Pereira
Staff
Solution

Hello Koya,

You can achieve that by setting into the parameters the structure that you want.
Please check the following example:

GridOS.ExternalAPI.addRow({PO_No: 'Ronaldo', Quantity: 15}, 0, GridOS.GridObject[0].gridId)

Thank you for your question. 

Tiago Pereira