ADF BC:Enable or Disable tableselectmany checkbox

Advertisement
Hai all
I'm developing a web application using Jdeveloper 10.1.3 and ADF BC.
In one of my pages,there is a adf table with tableselectmany which will be rendered as a
checkbox for each record in the table.
My requirement is to disable or enable this checkbox according to a value of a field in the
table.ie,If the value of a field is 'Y' it should be enabled and available
for selection,Otherwise not.
Is it possible to implement in ADF....
Please help me if anybody having a solution.....
Ans
Advertisement

Replay

The "value" attribute of a selectManyCheckbox will be bound to a List or an array. When the checkboxes are rendered, the values in the List or array will determine which checkboxes are initialized as checked. The selectItem components, or selectItems component inside the selectManyCheckbox gives you the list of checkboxes and the value of each. For instance, suppose my user can select from colors Red, Blue, and Green. I would have this:
<af:selectManyCheckbox value="#{myBackingBean.colors}" label="Colors">
  <af:selectItem label="Red" value="red"/>
  <af:selectItem label="Blue" value="blue"/>
  <af:selectItem label="Green" value="green"/>
</af:selectManyCheckbox>In the backing bean named myBackingBean:
private String[] colors = {"blue"};
/* getter and setter for colors go here */The checkbox labeled "Blue" is initialized as checked, the other two checkboxes are unchecked. When the form is submitted, the array named "colors" will have the values of the checkboxes that were checked. So if the user unchecks "Blue" and checks "Red" and "Green" the new contents of colors is {"red","green"}.
If you are asking about disabling some of the select items, that is easily done. Just bind the "disabled" attribute of the selectItem to a boolean value that evaluates to true if you want the item so that the user can't set or unset the checkbox, or the "rendered" attribute to a boolean value that evaluates to false if you don't want the item shown at all.