add element "ecole" from the left side to the rigth side and form the right side to th lelft side drag and drop richfaces
wawanito Oct 20, 2010 11:13 AMI want to add element "ecole" from the left side to the rigth side and form the right side to the lelft side
with drag and drop richfaces
http://livedemo.exadel.com/richfaces-demo/richfaces/dragSupport.jsf?c=dragSupport&tab=usage
I only can add one element i want to add all element that i want from the left side to the rigth
In my controller
/////////////////////////////////////////////////////////////////
private ArrayList<EcoleDoctoraleUna> listeEcoleUsed;
private ArrayList<EcoleDoctoraleUna> listeEcoleAvailable;
contructor{
this.setListeEcoleAvailable(new ArrayList<EcoleDoctoraleUna>());
listeEcoleAvailable=this.formationService.getAllEcoleMinusCible(monCodeFormation);
this.setListeEcoleUsed(new ArrayList<EcoleDoctoraleUna>());
listeEcoleUsed=this.formationService.getAllEcoleCible(monCodeFormation);
}
public void addDataToRetrieve(DropEvent event) {
EcoleDoctoraleUna de = (EcoleDoctoraleUna) event.getDragValue();
this.getListeEcoleAvailable().remove(de);
this.getListeEcoleUsed().add(de);
}
public void removeDataToRetrieve(DropEvent event) {
EcoleDoctoraleUna de = (EcoleDoctoraleUna) event.getDragValue();
this.getListeEcoleAvailable().add(de);
this.getListeEcoleUsed().remove(de);
}
In my jsp
///////////////////////////////////////////////////////////////////////////
<h:panelGrid columns="2">
<rich:panel>
<rich:panel style="float: left; border:none; height: 385px"/>
<h:dataTable id="listeEcoleAvailable" value="#{formationController.listeEcoleAvailable}" var="de" style="float: right;" width="250px">
<h:column>
<f:facet name="header">
<h:outputText value="Liste d'ecole" />
</f:facet>
<a4j:outputPanel style="cursor: move; border:1px solid gray;padding:2px; background-color: #E6E6E6" layout="block">
<rich:dragSupport dragType="de1" dragValue="#{de}"/>
<h:outputText value="#{de.libelleCourtEcole}"></h:outputText>
</a4j:outputPanel>
</h:column>
</h:dataTable>
<rich:dropSupport acceptedTypes="de2" dropValue="data" dropListener="#{formationController.removeDataToRetrieve}" reRender="listeEcoleAvailable, listeEcoleUsed">
</rich:dropSupport>
<rich:panel styleClass="spacer"/>
</rich:panel>
<rich:panel>
<rich:panel style="float: left; border:none; height: 385px"/>
<h:dataTable id="listeEcoleUsed" value="#{formationController.listeEcoleUsed}" var="de" style="float: right;" width="250px">
<h:column>
<f:facet name="header">
<h:outputText value="Liste d'ecole" />
</f:facet>
<a4j:outputPanel style="cursor: move; border:1px solid gray;padding:2px; background-color: #58FA58; " layout="block">
<rich:dragSupport dragType="de2" dragValue="#{de}" />
<h:outputText value="#{de.libelleCourtEcole}"></h:outputText>
</a4j:outputPanel>
</h:column>
</h:dataTable>
<rich:dropSupport acceptedTypes="de1" dropValue="data" dropListener="#{formationController.addDataToRetrieve}" reRender="listeEcoleAvailable, listeEcoleUsed">
</rich:dropSupport>
<rich:panel styleClass="spacer"/>
</rich:panel>
</h:panelGrid>