cancel
Showing results for 
Search instead for 
Did you mean: 

Grid delete row submenu

former_member231954
Participant
0 Kudos

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#)

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member185682
Active Contributor

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

former_member231954
Participant
0 Kudos

I check it with Event Logger and it seems like the flow is:

  1. Right Click Before = true
  2. MenuEvents
  3. Right Click Before = false

I will try it, but I need to be careful not to mess with other forms that are open (same Form Type).

former_member185682
Active Contributor
0 Kudos

Hi Szabolcs,

Yeap, you are correct. I wrote wrong the flow. Sorry for the mistake.

P.S: I corrected my mistake.

Kind Regards,

Diego Lother

pedro_magueija
Active Contributor
0 Kudos

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

former_member231954
Participant
0 Kudos

The MenuEvent object (that is passed as pVal on MenuEvents) does not have a FormUID, so I don't know which Form to get from SBO Application.

Also, the Grid's CommonSettings member only allows to color/format the cells.

pedro_magueija
Active Contributor
0 Kudos

Hi Szabolcs,

You're right, it's not in the CommonSettings. It's in the Grid itself.

grid.GetCellFocus();

It returns a CellPosition object.

Pedro Magueija

LinkedIn | Twitter | Blog