list - How to enable/disable specific item in selectManyCheckbox on ajax keyUp -


i need in enabling/disabling specific item in selectmanycheckbox component based on ajax call keyup.

when page loads, firing below method populate selectmanycheckbox items in form:

 @postconstruct      public void init() throws sqlexception {      this.hrcertificateslist.add(new hrcertificate(("employment"), "ce", false));      this.hrcertificateslist.add(new hrcertificate(("loan"), "lc", false));  } 

and here jsf code:

  <p:inputtext id="selectedemployee" value="#{hrrequest.selectedemployeecode}">       <p:ajax event="keyup" update="employeename" listener="#{hrrequest.getemployeename}" />     </p:inputtext>  <h:outputtext id="employeename" value="#{hrrequest.selectedemployeename}" />  <p:selectmanycheckbox id="hrcertificates" value="#{hrrequest.selectedhrcertificates}">  <f:selectitems value="#{hrrequest.hrcertificateslist}" var="hrcertificate"  itemlabel="#{hrcertificate.hrcertificatename}"     itemvalue="#{hrcertificate.hrcertificatecode}" itemdisabled="#{hrcertificate.hrbooleancertificate}"/>      </p:selectmanycheckbox> 

once page loads, checkboxes enabled , when user enters employeecode in inputtext, ajax fired call method employeename , check whether has loan or not, if has loan, checkbox should enabled, otherwise disabled.

to summarize issue, want when value of variable temp equals yes, need disable loan checkbox , other item employment should remain enable, how can this?

the bean code is:

 public string getemployeename() throws sqlexception {      if (temp.equals("yes")) {  //how enable , disable loan checkbox , update form view requestcontext.getcurrentinstance().update(":hrform:hrcertificates");     } 

so can please help.

just manipulate model in such way itemdisabled="#{hrcertificate.hrbooleancertificate}" evaluates true instead of false view knows must do.

one way might be:

this.hrcertificateslist.get(1).sethrbooleancertificate(true); 

Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -