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 user as Row Selection of af:table is not synchronized with model or binding layer
See Problem-
- I have an editable table on page
- Added a validation to check negative value in field of LocationId, now navigate to another row
- See selected focus is on Academic, but problem is when there is validation failure, why it is showing other row as selected ?
- If you check in ViewObject , you will find that row with DepartmentName Human Resource is 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 proprty-
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 it's value is
<auto>
Change it to
<always> and now see behavior on page
now if you try to select another row, it is not get selected and selected focus is on row with validation
Sample ADF Application-Download
Cheers - Happy Learning :-)