Monday, February 27, 2012

List Of Values always returning 1st Row

On version 11.1.1.4.0 (very possibly on later versions too).

Old issue that I recently encountered again, thought it worth listing for reference purposes.

Problem: No matter which row the user selects on the List of Values (LOV) component, the LOV always returns the 1st row of LOV collection to the input field associated to it.

Solution: Check LOV View Object's attributes, you will find that no attribute(s) have been identified as Key attributes.

Explanation: Once the row in the LOV is selected, ADF does a getKey on the row to determine the Key which uniquely identifies the row in the View Object (which returns null or Empty Key if no Key is specified).  After that it does a findByKey on the LOV View Object to get the values to be returned to the af:inputTextListOfValues field.  Because the key is null, the findByKey does not know which View Object row to retrieve and at this point it just returns the first row of the LOV View Object rowset.

Specify your Key attributes, even if you have to make up a composite unique key on the VO, and your problem will be resolved.

No comments:

Post a Comment