This one had me up the wall for quite a bit of while…
I’ve been searching the web for all permutations of “ADF Delete button removes the wrong row” with no luck. But then I finally found the answer.
When a view object is dragged onto a page as a table and you then drag the Delete-operation in. You do not use the operations toolbar – for whatever reason.
What happens (at least for me) is that pressing the Delete button will delete the topmost record – not the record where the button was pushed.
This happens because the Delete operation will delete the view object iterators current row. That row will be the first row – for some reason I haven’t researched.
Here is what you do:
The iterators current row must be slaved to the selected row. This looks like this :
The magic is three places. First “rowselection” must be “single”. Second and third notice the “selectedRowKeys” and “selectionListener” attributes. Both must be set just like above (replace “EmployeeVO1” with you own view object).
The answer was in What You May Need to Know About Setting the Current Row in a Table – Oracle® Fusion Middleware Fusion Developer’s Guide for Oracle Application Development Framework – note to self: don’t knock the documentation of the product.
But is seems to me that JDeveloper should add those attributes automatically – at least one the delete button is dragged onto the page. But maybe that’s just me.
You can download the example here.