Error on Programmatically changing the SelectManyCheckbox List in Oracle ADF -
i have selectmanychecbox on jsff bound list in managed bean.
now issues when click on radio button, of check boxes should removed, ie list should updated have lesser number of check boxes.
now when have selected lets 5 out of 10 check boxes, , when update list, leaves me 2 options in check boxes...and @ point adf faces raise issue selection should limited , all.
please tell me how reset checkboxes default/unselected state before updating list.
or there other way rid of error
here example, , works:
<f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"> <af:document title="main.jsf" id="d1"> <af:form id="f1"> <af:panelgrouplayout id="pgl1"> <af:selectoneradio label="setvalues" id="sor1" autosubmit="true" valuechangelistener="#{viewscope.test.onsetvalues}" value="#{viewscope.test.values}"> <af:selectitem label="5 values" value="0" id="si2"/> <af:selectitem label="3 values" value="1" id="si3"/> </af:selectoneradio> <af:selectmanychoice label="selectmanycheckbox" id="smc1" binding="#{viewscope.test.comp}"> <f:selectitems value="#{viewscope.test.list}" id="si1"/> </af:selectmanychoice> </af:panelgrouplayout> </af:form> </af:document>
public class testbean { private arraylist<selectitem> list; private long values; private richselectmanychoice comp; public testbean() { super(); list = new arraylist<selectitem>(); restorelist(); } private void restorelist() { list.clear(); list.add(new selectitem(false, "value 1")); list.add(new selectitem(false, "value 2")); list.add(new selectitem(false, "value 3")); list.add(new selectitem(false, "value 4")); list.add(new selectitem(false, "value 5")); } private void cutlist() { list.clear(); list.add(new selectitem(false, "value 1")); list.add(new selectitem(false, "value 2")); list.add(new selectitem(false, "value 3")); } public void setlist(arraylist<selectitem> list) { this.list = list; } public arraylist<selectitem> getlist() { return list; } public void onsetvalues(valuechangeevent valuechangeevent) { if ((long)valuechangeevent.getnewvalue() == 0) restorelist(); else { cutlist(); } comp.setvalue(null); comp.processupdates(facescontext.getcurrentinstance()); adffacescontext.getcurrentinstance().addpartialtarget(comp); } public void setvalues(long values) { this.values = values; } public long getvalues() { return values; } public void setcomp(richselectmanychoice comp) { this.comp = comp; } public richselectmanychoice getcomp() { return comp; }
Comments
Post a Comment