Primefaces picklist target value to populate a separate data

UI Components for JSF
Post Reply
RickSoftly
Posts: 4
Joined: 03 Jan 2011, 19:22

04 Jan 2011, 12:10

(Cross posted from http://stackoverflow.com/questions/4587 ... -datatable) 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?

Code: Select all

<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:

Code: Select all

public void init() {
    loginEJB.setupMockMaterial();
    source = new ArrayList<String>();
    target = new ArrayList<String>();
    populateSource();
    materials = new DualListModel<String>(source, target);
}

private void populateSource() {
    List<Material> materialList = materialEJB.findMaterials();
    for (Material m : materialList) {
    source.add(m.getName());
}
}

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 39 guests