Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

primefaces partial processing not working

I would like to use partial processing but it does not work in my code. Does anybody knows why?

<h:form id="frmVehicle" prependId="false">
   <p:toolbar styleClass="form_toolbar">   
      <p:toolbarGroup>
        <p:commandButton id="save" process="@(form :not(.noprocess))" ajax="false" value="#{uimsgs.save}" action="#{vmsVehicleActionBean.save()}"
      </p:toolbarGroup>
    </p:toolbar>
    <p:messages id="vmsgs" severity="error,warn" autoUpdate="true" />
    <p:tabView id="tabViewSections" orientation="left" styleClass="ses-ui-tabs-left">
      <p:tab title="#{vms_uimsgs['vehicle.tab.data']}">
        <p:panelGrid id="gridHeader" columns="4" columnClasses="form-label,form-input,form-label,form-input" styleClass="form-grid" >
           <p:outputLabel for="kmStatus" value="#{vms_uimsgs['vehicle.kmStatus']}" />
           <p:inputText id="kmStatus" value="#{vmsVehicleActionBean.vehicle.kmStatus}"/>
           <p:outputLabel for="powerKw" value="#{vms_uimsgs['vehicle.power']}" />
           <p:inputText id="powerKw" styleclass="noprocess" value="#{vmsVehicleActionBean.powerKw}">
              <p:ajax event="keyup" update="powerPs" />
           </p:inputText>
           <p:outputLabel value="kw" />
           <p:inputText id="powerPs" styleclass="noprocess" value="#{vmsVehicleActionBean.powerPs}"> 
             <p:ajax event="keyup" update="powerKw" />
           </p:inputText>
           <p:outputLabel value="ps" />
         </p:panelGrid>
       </p:tab>
     </p:tabView>
 </h:form>

The two setters (kw & ps ) are still processed. Any idea?

like image 423
jobe Avatar asked May 16 '13 16:05

jobe


1 Answers

Well i created an example thats works for the standard Primefaces showcase. In your page i see something strange. styleclass="noprocess" are you sure you use this? The API says styleClass with a capital C.

Here is an example wich works oke:

<h:form id="form">
    <p:toolbar id="tool">
        <p:toolbarGroup id="group">
            <p:commandButton value="All" ajax="true" id="btnAll" process="@(input:not(.noprocess))" actionListener="#{personBean.savePerson}" />
        </p:toolbarGroup>
    </p:toolbar>
    <p:messages id="vmsgs" severity="error,warn" autoUpdate="true" />
    <p:tabView id="tabViewSections">
        <p:tab title="test" id="tab">
            <p:panel header="Partial Process">
                <p:panelGrid id="grid" columns="2">
                    <f:facet name="header">
                        <p:messages />
                    </f:facet>
                    <h:outputLabel for="firstname" value="Firstname:" />
                    <p:inputText id="firstname" value="#{personBean.firstname}" />
                    <h:outputLabel for="surname" value="Surname: *" />
                    <p:inputText id="surname" value="#{personBean.surname}" styleClass="noprocess">                         
                    </p:inputText>
                </p:panelGrid>
            </p:panel>
        </p:tab>
    </p:tabView>
</h:form>

And then bean:

public class PersonBean {  

    private String firstname;  

    private String surname;  

    public String getFirstname() {  
        return firstname;  
    }  
    public void setFirstname(String firstname) {  
        this.firstname = firstname;
        System.out.println("Setted firstname: " +firstname);
    }  

    public String getSurname() {  
        return surname;  
    }  
    public void setSurname(String surname) {  
        this.surname = surname;  
        System.out.println("Setted surname: " +surname);
    }  

    public void savePerson(ActionEvent actionEvent) {  
         System.out.println("Fire action event");

    }  
}
like image 132
Tankhenk Avatar answered Oct 03 '22 21:10

Tankhenk