Tuesday, September 29, 2015

Smart Combo Box LOV Based on Description Attribute

I had a question from blog reader for my previous post about smart Combo Box LOV - Smart Combo Box LOV with Filter. Reader was asking if it is possible to define Combo Box LOV on description rather than ID attribute. ADF BC out of the box allows to define LOV on readonly description attribute. I had a post about it - Defining the LOV on a Reference Attribute in Oracle ADF 11g. Today I will test and describe how the same can be applied for Combo Box LOV in ADF 12c.

If you want to define Combo Box LOV on description attribute, first thing to do is to create Association between main EO and EO from where description attribute should come:

Based on association we can define left outer join and bring description attribute to the main VO:

Description attribute is readonly, since it comes from join:

Combo Box LOV should be defined directly for this readonly description attribute. We should return description and key - both attributes. ADF BC would display description on UI, but it would return key attribute in the background:

Combo Box is set to filter initial list based on criteria, same as in previous blog mentioned above:

UI implementation contains LOV Combo Box mapped with JobTitle attribute:

This is how it looks on UI. LOV Combo Box displays description attribute and in the background it updates JobId. Same works in both table and form UI:

Combo Box LOV displays multiple attributes and rows are filtered based on initial View Criteria:

Download sample application - SmartComboLOV_v2.zip.

No comments: