ICE checkbox 用法
Hello everybody,
I have a datable which contain multiple lines gotten from database, in the header of the datable i have a checkbox
<ice:dataTable rows="10" id="inventoryList"
value="#{Bordereau.listFiche}" var="item"
binding="#{ModifierDM.inventoryList}">
.....I have many columns and the last one contains
<ice:column>
<f:facet name="header">
<ice:selectBooleanCheckbox id="selectAll" binding="#{ModifierDM.selectAllCheckbox}" valueChangeListener="#{ModifierDM.selectAll}" partialSubmit="true"/>
</f:facet>
<ice:selectBooleanCheckbox id="select" binding="#{ModifierDM.selectCheckbox}" />
</ice:column>
</ice:dataTable>
The purpose is to be able to check all checkboxes if i check the header's one.
But nothing happen !
Here is my class
package com.atos.him.beanManager;
import java.util.List;
import javax.faces.component.UISelectBoolean;
import javax.faces.event.PhaseId;
import javax.faces.event.ValueChangeEvent;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.atos.him.entity.DossierMedical;
import com.atos.him.entity.Fiche;
import com.atos.him.services.DossierMedicalService;
import com.atos.him.services.FicheService;
import com.icesoft.faces.component.ext.HtmlDataTable;
import com.icesoft.faces.component.ext.HtmlSelectBooleanCheckbox;
public class ModifierDMBean {
private DossierMedicalService dossierMedicalService;
private FicheService ficheService;
private HtmlDataTable inventoryList;
private Fiche ficheSelectione;
private UISelectBoolean selectAllCheckbox;
private UISelectBoolean selectCheckbox;
private boolean selected;
public boolean isSelected() {
return selected;
}
public void setSelected(boolean selected) {
this.selected = selected;
}
public UISelectBoolean getSelectAllCheckbox() {
return selectAllCheckbox;
}
public void setSelectAllCheckbox(UISelectBoolean selectAllCheckbox) {
this.selectAllCheckbox = selectAllCheckbox;
}
public UISelectBoolean getSelectCheckbox() {
return selectCheckbox;
}
public void setSelectCheckbox(UISelectBoolean selectCheckbox) {
this.selectCheckbox = selectCheckbox;
}
public Fiche getFicheSelectione() {
return ficheSelectione;
}
public void setFicheSelectione(Fiche ficheSelectione) {
this.ficheSelectione = ficheSelectione;
}
@SuppressWarnings("unused")
private List<Fiche> listFiche;
@SuppressWarnings("unused")
private List<DossierMedical> listDossier;
public ModifierDMBean() {
ApplicationContext appc = new ClassPathXmlApplicationContext(
"applicationContext.xml");
setDossierMedicalService((DossierMedicalService) appc
.getBean("dossierMedicalService"));
setFicheService((FicheService) appc.getBean("ficheService"));
}
public DossierMedicalService getDossierMedicalService() {
return dossierMedicalService;
}
public void setDossierMedicalService(
DossierMedicalService dossierMedicalService) {
this.dossierMedicalService = dossierMedicalService;
}
public FicheService getFicheService() {
return ficheService;
}
public void setFicheService(FicheService ficheService) {
this.ficheService = ficheService;
}
public List<Fiche> getListFiche() {
return ficheService.getListfiche();
}
public void setListFiche(List<Fiche> listFiche) {
this.listFiche = listFiche;
}
public HtmlDataTable getInventoryList() {
return inventoryList;
}
public void setInventoryList(HtmlDataTable inventoryList) {
this.inventoryList = inventoryList;
}
public List<DossierMedical> getListDossier() {
return dossierMedicalService.getListDossierMedical();
}
public void setListDossier(List<DossierMedical> listDossier) {
this.listDossier = listDossier;
}
public String actTable() {
return "success";
}
public String updateDossier() {
ficheService.update(ficheSelectione);
return "success";
}
public void deleteDossier() {
ficheService.delete(ficheSelectione);
}
public void selectAll(ValueChangeEvent e) {
if (!e.getPhaseId().equals(PhaseId.INVOKE_APPLICATION)) {
e.setPhaseId(PhaseId.INVOKE_APPLICATION);
e.queue();
return;
}
selectCheckbox.setValue(true);
selected = true;
}
}
am waiting your answers
https://coderanch.com/t/538212/java/checkAll-Multiple-checkbox-datatable-IceFaces
本文来自博客园,作者:aspirant,转载请注明原文链接:https://www.cnblogs.com/aspirant/p/7419754.html