Primefaces Mini Cookbook

2019/05/20

Primeface mini Cookbook

This cookbook was extracted data from here: https://www.primefaces.org/docs/guide/primefaces_user_guide_6_0.pdf

AjaxCore


- ###   [PartialSubmit](https://www.primefaces.org/showcase/ui/ajax/partialSubmit.xhtml)
```xml
<p:inputText id="name" />
<p:commandButton value="False" partialSubmit="false" process="name" />
<p:commandButton value="True" partialSubmit="true" process="name" />


-   [Process](https://www.primefaces.org/showcase/ui/ajax/process.xhtml)
```xml
<h:form>      
    <h:panelGrid id="grid" cellpadding="5" columns="2" style="margin-bottom:10px">
        <f:facet name="header">
            <p:messages id="msgs" />
        </f:facet>
 
        <p:outputLabel for="firstname" value="Firstname:" />
        <p:inputText id="firstname" value="#{userView.firstname}" />
 
        <p:outputLabel for="surname" value="Surname:" />
        <p:inputText id="surname" value="#{userView.lastname}" required="true" requiredMessage="Surname is required." />
    </h:panelGrid>
 
    <h:panelGrid columns="6" cellpadding="5">
        <p:commandButton value="All"  process="@all" update="grid" action="#{userView.save}" />
        <p:commandButton value="Form" process="@form" update="grid" action="#{userView.save}" />
        <p:commandButton value="This"  process="@this" update="grid" action="#{userView.save}" />
        <p:commandButton value="None"  process="@none" update="grid" action="#{userView.save}" />
        <p:commandButton value="Parent" process="@parent" update="grid" action="#{userView.save}" />
        <p:commandButton value="This Surname"  process="@this,surname" update="grid" action="#{userView.save}" />
    </h:panelGrid>
</h:form>
Selector Type Description
@this Standard Current component.
@all Standard Whole view.
@form Standard Closest ancestor form of current component.
@none Standard No component .
@namingcontainer PrimeFaces Closest ancestor naming container of current component.
@parent PrimeFaces Parent of the current component.
@composite PrimeFaces Closest composite component ancestor.
@child(n) PrimeFaces nth child.
@row(n) PrimeFaces nth row.
@previous PrimeFaces Previous sibling.
@next PrimeFaces Next sibling.
@widgetVar(name) PrimeFaces Component with given widgetVar.
@root PrimeFaces to start searching from the root instead the current component.
@id PrimeFaces Used to search components by their id ignoring the component tree structure and naming containers.
Multiple keywords Primefaces can be combined in a single expression using colon; for example: @form:@parent @composite:mybuttonid @this:@parent:@parent @form:@child(2)
Primefaces jQuery Selector Description
update=”@(form)” Update all forms
update=”@(form:first)” Update first form
update=”@(.mystyle)” Update all components that has styleClass named mystyle
update=”@(:input)” process=”@(:input)” Update and process all inputs
update=”@(.ui-datatable)” Update all datatables
process=”@(.ui-panel :input)” update=”@(.ui-panel)” Process input components inside any panel and update all panels
process=”@(:input:not(select))” Process input components but not select components
update=”@(:input:disabled)” Update input components that are disabled
update=”compId :form:compId @(:input) @parent:@child(2)” PFS can be used with other referencing approaches as well;

Input

Button

Data

Panel

Overlay

Charts

ChartJs

Messages

Multimedia

File

DragDrop

Dialog Framework

Misc

Post Directory