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.
- 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
Sample ADF Application-Download
Cheers – Happy Learning 🙂
An Oracle ACE, Blogger, Reviewer, Technical Lead working on Oracle ADF