Wednesday, July 20, 2011

Simple Implementation of AF SelectManyChoice being used in a clickToEdit Table

I'm making a quick blog for a not-so-obvious solution when using a SelectManyChoice. I complicated the scenario a little bit by using this component in a table.

The Adf SelectManyChoice uses List<String> as its value type. Unfortunately, this stops you from directly using it or binding it to a pageDef attribute bindings.

A solution for this is by using a BackingBean and take a handle on its getter and setter while resolving or pointing the value to-and-from the actual value holder.

In my example, I will present an attribute with attributeName "CODE" and this code value will be read by the selectManyChoice as well as modified. Also, I'm showing the "CODE" attribute as inputText so that I can present how the "read" part works.

First I prepare my selectManyChoice's options by utilizing a pageFlowBean. Oh, I also use this same mBean to hold my table rows. (PageFlowScope)

Here's my pageFragment which utilizes the List<Map> as my data collection. Take note of my item's scope since I only want to initialize my items once (not that it matter in a prototype hehe).


Here's my backingBean which handles the manipulation for setting the code value on selection as well as the reading piece of it. (Really think there has to be a more optimized solution though, but oh well). (BackingBeanScope)

Since we are setting the value and retrieving it using ValueExpression, we are able to evaluate the value at runtime.

1 comment:

  1. Hi,
    Can u please send the workspace to my mail[].