Blocking row navigation in af:table, synchronize row selection with model in case of validation failure- Oracle ADF

Sharing is Caring

In ADF we often work on editable af:table and when we use af:table to insert, update or delete data, it is normal to use some validation but problem is when some validation failure occurs on page (in af:table) , still we can select another row and it shows as currently selected Row. This is a bit confusing for the user as Row Selection of af:table is not synchronized with the model or binding layer so in this post we’ll learn about blocking row navigation in af:table in case of validation failure.

See Problem- 

  • I have an editable table on page
  • Added a validation to check negative value in the field of LocationId, now navigate to another row

 

  • See selected focus is on Academic, but the problem is when there is validation failure, why it is showing another row as selected?
  • If you check in ViewObject, you will find that row with DepartmentName Human Resource is the current row

ADF framework provides a property in af:table to control navigation in af:table when there is some error or validation failure- blockRowNavigationOnError
See in oracle docs about this property-

Valid Values: always, never, auto

Whether we want to block row navigation in case of validation failure.
This is when you select a row and do some editing inside the table or in a related form, and this editing causes some validation failures. At this time, if you click on a different row in table, we want to block you from moving to the new row.
possible values are: always, never and auto. default value is auto.

  • always means we block the row navigation
  • never means we don’t block and let the row navigation happen
  • auto means the framework will make the decision

 



by default in af:tabel its value is <auto>

Change it to <always> and now see behaviour on the page

now if you try to select another row, it is not get selected and selected focus is on the row with validation

Blocking row navigation

Sample ADF Application-Download
Cheers – Happy Learning 🙂

Related Posts

0 thoughts on “Blocking row navigation in af:table, synchronize row selection with model in case of validation failure- Oracle ADF”

  1. Hello Sir i hope you are well, i'm working on CRUD case with , my field are autosubmitted. I have this behaviour: the cursor navigate from the newly added row to an existing row when i perform the action CreateInsert. I use the method to set focus on selected row but it didn't fix the problem. Please help me to fix the problem Souheil

Leave a Reply

Your email address will not be published. Required fields are marked *