!--a11y-->
Deleting Single or Several Rows 
Since you have already defined the lead selection when you created and bound the table to the context in addition to implementing the option of multiple selection, you now simply need to read this in the next step in order to be able to delete the selected data records.
...
1. Choose TutWD_Table_Init à Web Dynpro à Web Dynpro Components à TableComp à Views à TableCompBasketView and start this by double-clicking for editing.
2. Switch to the Layout tab.
3. In the Outline, click with the secondary mouse button on the table ShoppingBasket and choose Insert ToolBar.
4. In the Outline, click with the secondary mouse button on ToolBar and choose Insert Child.
5. Leave the ToolBarButton unchanged as type, assign as ID DeleteProductButton, and confirm with Finish.
6. Select the ToolBarButton and click the pushbutton …in the value field of the onAction event property in the Properties tab. The New Action window opens.
7. Enter DeleteProducts as name and Delete Products as text. Leave the other settings unchanged and choose Finish.
8. Switch to the implementation of the event handler onActionDeleteProduct and insert the following code:
onActionDeleteProduct() |
//@@begin onActionDeleteProduct(ServerEvent) int n = wdContext.nodeProducts().size(); int leadSelected = wdContext.nodeProducts().getLeadSelection(); // loop backwards to avoid index troubles for (int i = n - 1; i >= 0; --i) { if (wdContext.nodeProducts().isMultiSelected(i) || leadSelected == i) { wdContext.nodeProducts().removeElement(wdContext.nodeProducts(). getElementAt(i)); } } //@@end |

To avoid problems with the index, the context is here executed in reverse. All elements selected in the table are deleted.
9.
Save the current
status of your project by choosing
Save all Metadata.