Tuesday, February 28, 2012

ADF 11g: SelectOneChoice not showing

Creating a dropdownlist with a List of Values for an attribute is easy in ADF 11g: create a ViewObject, link it with a List of Values through a View Accessor and add the List of Values to your attribute. That's basically it. If you now drag-and-drop said attribute on your page, JDeveloper will ask you if you want to drop it as a 'Single Selection'. There you select 'ADF Select One Choice', and voila, there you have a dropdownlist with your List of Values.

But sometimes, and it has happened to me before, the dropdownlist is not showing. Of course, you start to check and double check, even up to the point where you just delete everything you just did, and start over. To no avail.

If you ever face this issue, bear in mind that 1 simple configuration can mess up your result. In this particular case, I had the List of Values linked to a Transient Attribute. Of course, Transient Attributes are, by default, not editable. This is quickly fixed by changing the 'Updatable'-property to 'Always'.


If you now run your application again, the dropdownlist is showing correctly! This is one of those things you actually know, but run into every now and again. Especially if it's been a while since you linked a List of Values to a Transient Attribute...