Skip to Content

Grid delete row submenu

I have a Grid on a custom form, where the user should add and delete rows before processing the results (I used a DataTable for datasource). I could create the row adding functionality, but the delete action won't persists to the DataTable.

I enabled the right click 'delete row' menu (id: 1293), and If the user press it, it deletes the row visually, but the row won't get deleted from the DataTable.

I tried to handle the event, when the delete row is pressed, after the press, I could delete the row from the datatable manually, but If I catch a MenuEvent (Menu Click, MenuID check), I won't have a "row" parameter, so I don't know which row to delete. The grid is also missing such an event (OnRowDelete or similar).

How can I persists the delete action to the Grid?

(I am using SAP 9.2 with UI and DI API C#)

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Dec 15, 2016 at 11:02 AM

    Hi Szabolcs,

    In this case you need to combine the RightClickEvent. When the user execute a right click action you receive this event with a parameter of the type ContextMenuInfo in this parameter you can see the ItemUID and colUID, so, keep the values in a global variable and then use this values on your menu event.

    The flow is the following:

    1. RightClickEvent before action
    2. MenuEvent
    3. RightClickEvent after action

    Hope it helps.

    Kind Regards,

    Diego Lother

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 15, 2016 at 12:35 PM

    Hi Szabolcs,

    There are two other alternatives.

    1. Force the user to select a line before allowing the menu action to be handled (you can check during the menu event if lines are selected)

    2. Check if a cell has focus using the CommonSettings and use it's row index (does not work for completely disabled grids).

    The third option is what Diego suggested with globals.

    Pedro Magueija

    LinkedIn | Twitter | Blog

    Add comment
    10|10000 characters needed characters exceeded