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

Hi, it is possible to pass the RowId or the value from the cell using the action from the ContextMenuIntem?


Solution
Processing Upload...

Hello David Rodrigues,

Thanks for bringing this subject to the discussion.

Yes it is possible to pass the RowId and the cell value using the ContextMenu.

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

Nonetheless, it would look something like this:

GridOS.ContextMenuFeature.GetSelectedCell = function(gridId) {
    var selectedCellData = GridOS.SelectionFeature.selectedCells(gridId, false).summary; 

    alert(GridOS.ExternalAPI.getCellElement(selectedCellData.row, selectedCellData.col, gridId).innerText);
}

GridOS.ContextMenuFeature.GetSelectedRow = function(gridId) {
    var selectedCellData = GridOS.SelectionFeature.selectedCells(gridId, false).summary; 

    alert("Row Id: " + selectedCellData.row);
}

 

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

Thank you

Solution

Gabriel Lundgren wrote:

Hello David Rodrigues,

Thanks for bringing this subject to the discussion.

Yes it is possible to pass the RowId and the cell value using the ContextMenu.

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

Nonetheless, it would look something like this:

GridOS.ContextMenuFeature.GetSelectedCell = function(gridId) {
    var selectedCellData = GridOS.SelectionFeature.selectedCells(gridId, false).summary; 

    alert(GridOS.ExternalAPI.getCellElement(selectedCellData.row, selectedCellData.col, gridId).innerText);
}

GridOS.ContextMenuFeature.GetSelectedRow = function(gridId) {
    var selectedCellData = GridOS.SelectionFeature.selectedCells(gridId, false).summary; 

    alert("Row Id: " + selectedCellData.row);
}

 

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

Thank you

 I ended up using:

GridOS.ContextMenuFeature.GetSelectedCell()

 and then:

GridOS.ExternalAPI.getCellValue()

Because i'm using comboboxes. This way i can get the value of the cells.