456
Views
4
Comments
Solved
[OutSystems Data Grid] Get current right clicked row and add values as context items
outsystems-data-grid
Reactive icon
Forge asset by OutSystems
Application Type
Reactive

Hello guys,

is it possible to get the current row data where the rightclick was executed (the row is NOT selected!)?

and can i add dynamic items (with on click action) to the context menu before the context menu is showing?


Thank you




2022-07-19 16-56-14
Giuliana Silva
Staff
Solution

Hi @NITHIN ARADHYA,

You can use the following pieace of code to get the current selected rows:

OutSystems.GridAPI.Selection.GetAllSelections($parameters.GridId);

If any row is selected, it will return the topRowIndex and bottomRowIndex as well as the column indexes corresponding to the selection.

Cheers,

Giuliana.

2019-07-01 15-21-53
b.marcelino

Hi @AndiK,

Thanks for reaching us.

You can add items to your context menu on your grid. To add the reported behavior to right click, with just need to use the block MenuItem_CustomOption of the Grid and on the event "ClickEvent" use a JS node with this API: GridAPI.Rows.GetRowData(gridID, rowNumber). You need to pass the GridId and the RowNumber. Check the image below:

Please check if this works for you.

Thanks
Bruno Marcelino



UserImage.jpg
NITHIN ARADHYA

I tried the way you suggested as above but it didn't work MenuItem_CustomOption was added and handler was connected for Click event but it wasn't triggering the action . The main ask is row number not the trigger I can trigger the click event by using below piece of code in JS . The main ask is to get the row id or number on click through js would be great because the column data and row data we are getting from backend

Screenshot 2023-01-19 at 9.45.52 PM.png
Screenshot 2023-01-19 at 9.45.52 PM.png
Screenshot 2023-01-19 at 9.39.36 PM.png
2022-07-19 16-56-14
Giuliana Silva
Staff
Solution

Hi @NITHIN ARADHYA,

You can use the following pieace of code to get the current selected rows:

OutSystems.GridAPI.Selection.GetAllSelections($parameters.GridId);

If any row is selected, it will return the topRowIndex and bottomRowIndex as well as the column indexes corresponding to the selection.

Cheers,

Giuliana.

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