Primefaces picklist target value to populate a separate datatable
Excuse me for posting here and not on the primeFaces forum, but I can't seem to register on their forums (I never get the confirmation email EDIT: note to self: always check the spambox). I'm using primefaces 2.2RC. I have a wizard component embedded in a tabbed window component. The workflow wizard asks the user to pick a material from a . I want the outcome of that picklist (picklist.target) to populate a . I see that there is now an onTransfer attribute on picklist but no documentation on how to use it.
The code works and populates the picklist and I can pick strings and advance to the next tab. I just can't get the updated(?) materials.target list. Can anyone give a clue?My code below:
<p:tab id="Step3" title="Pick materials">
<p:panel header="Step 3" >
<p:pickList value="#{materialPickListBean.materials}" var="mat"
itemLabel="#{mat}" itemValue="#{mat}" converter="matConverter" onTransfer="">
<f:facet name="sourceCaption">Available</f:facet>
<f:facet name="targetCaption">Picked</f:facet>
</p:pickList>
</p:panel>
</p:tab>
<p:tab id="Step4" title="Adjust material quantites">
<p:panel header="Step 4">
<p:dataTable value="#{materialBean.materialList}" var="matList"
dynamic="true" id="pickedMaterials">
<f:facet name="header">Select material quantities</f:facet>
<p:column>
<f:facet name="header">
<h:outputText value="Material description" />
</f:facet>
<h:outputText value="#{matList.name}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="unit type" />
</f:facet>
<h:outputText value="#{matList.unitOfMeasurement}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="units" />
</f:facet>
<h:inputText value="#{matList.quantity}" />
</p:column>
</p:dataTable>
<p:commandButton value="Submit" actionListener="#{jobCardWizard.save}"/>
</p:panel>
</p:tab>
bean:
public void init() {
loginEJB.setupMockMaterial();
source = new ArrayList<String>();
target = new ArrayList<String>();
populateSource();
materi开发者_如何学Cals = new DualListModel<String>(source, target);
}
private void populateSource() {
List<Material> materialList = materialEJB.findMaterials();
for (Material m : materialList) {
source.add(m.getName());
}
}
public DualListModel<String> getContactsList() {
return contactsList;
}
public void setContactsList(DualListModel<String> contactsList) {
this.contactsList = contactsList;
}
public List<String> targetContacts(){
this.selectedContacts = contactsList.getTarget();
}
I eventually went with the Richfaces implementation of the picklist. I have both rich and primefaces in the project.
精彩评论