[Data Grid] Call target of SendSelectedRows from ContextMenu instead of button

Forge Component
(41)
Published on 13 Oct (11 days ago) by OutSystems R&D
41 votes
Published on 13 Oct (11 days ago) by OutSystems R&D

Let's say I have a SendSelectedRows button called ApproveButton, and a Server Action called ApproveSelected that returns a URL for a REST POST, and I want to be able to select one or more items from the list that displays in the DataGrid, and send the data for the rows that I have selected to the ApproveSelected action.

Is it possible to call ApproveSelected from the context menu instead of calling it from ApproveButton, passing in the JSON of the selected rows from the grid?

Thanks,

Coy Kissee

Solution
Processing Upload...

Hello Coy Kissee,


Thanks for bringing this subject to the discussion.

 Yes it is possible, but you need to make changes in some specific methods.

I've attached a sample that does what you asked for. The script is located inside the Grid web screen.

The menu contains the ApproveSelected action that sends the JSON of the selected rows. Note that it send rows only, cells are not being sent.


If you have any questions, feel free to ask us.

Thank you

Solution

Gabriel Lundgren

Thank you for your quick response.  I was able to get your sample working as expected.  I put the SendSelectedElements call in my module, but when I click on the menu item, nothing happens, and the breakpoint that I put in the destination REST call never gets triggered.  Are there some additional changes that I need to address in order to get this to work properly?


Thanks,

Coy Kissee

Coy Kissee,

Can you post your OML so I can take a look at it? Without context, there isn't much I can do.

 

Gabriel Lundgren wrote:

Coy Kissee,

Can you post your OML so I can take a look at it? Without context, there isn't much I can do.

 

 I'm not comfortable with posting my entire project. Is there a way I can work with you directly?


Thanks,

Coy Kissee

 

Can you create a representative sample on what you are trying to do and send me?



Gabriel Lundgren,

I just found that you also overrode the JS in the screen definition as well.  Once I updated that, it worked as expected. 


Thanks so much for your help!

Coy Kissee