• Settings
    • Locale
    • Change the locale of the datepicker, schedule and client side validation messages.

      Language
      English
      English
      English
      French
      German
      German
      German
      Italian
      Korean
      Spanish
      Catalan
      Dutch
      Portuguese
      Portuguese
      Arabic
      Arabic
      Bulgarian
      Bangla
      Bosnian
      Czech
      Greek
      Estonian
      Persian
      Finnish
      Danish
      Hindi
      Indonesian
      Icelandic
      Croatian
      Japanese
      Hungarian
      Hebrew
      Georgian
      Central Kurdish
      Khmer
      Kyrgyz
      Kazakh
      Lithuanian
      Latvian
      Malay
      Norwegian
      Polish
      Romanian
      Russian
      Slovak
      Slovenian
      Serbian
      Serbian
      Swedish
      Thai
      Turkish
      Ukrainian
      Uzbek
      Vietnamese
      Chinese
      Chinese
  • Resources
Theme
Theme
Preset primefaces.THEME
Apple Liquid Glass style: translucent overlays, menus and bars that blur the page behind them, capsule buttons.
Color scheme color-scheme
Input style p-input-filled
Density data-p-density
Direction primefaces.DIR
Colors
Primary --p-primary-base
Surface --p-surface-*
Shape and motion
Button shape --p-button-border-radius
Shadows --p-*-shadow
Animations --p-transition-duration
Ripple --p-ripple-opacity
Border radius --p-border-radius-*
Typography
Focus ring
Form field
CSS
Only the tokens that differ from the preset.

                        
                    

DataView Lazy

DataView has built-in support to deal with huge datasets. In order to enable lazy loading, a LazyDataModel needs to be implemented to query the datasource when pagination happens. This example uses an in-memory list to mimic a real datasource like a database. In a real application, loading should be executed with the query built using the information passed to the load method.

DataView Tag Documentation

DataView displays data in grid or list layout.

NameTypeRequiredDefaultDescription
binding UIComponent false generated An EL expression referring to a server side UIComponent instance in a backing bean.
rendered boolean false true Boolean value to specify the rendering of the component, when set to false component will not be rendered.
value Object true Datasource of the component.
lazy boolean false True, if the value-binding is instance of LazyDataModel. Defines if lazy loading is enabled for the data component.
paginatorAlwaysVisible boolean false true Defines if paginator should be hidden if total data count is less than number of rows per page.
paginator boolean false false Enables pagination.
touchable Boolean false Enable touch if supported by device. NULL uses global default or primefaces.TOUCHABLE. Default: globally enabled.
first int false 0 Index of the first data to display.
gridRowStyle String false Inline style of each row (grid-cell) in grid layout.
style String false Inline style of the component.
rowStatePreserved boolean false false Keeps state of its children on a per-row basis.
layout String false list Layout of the items, valid values are "list" and "grid".
pageLinks int false 10 Maximum number of page links to display.
rowIndexVar String false Name of iterator to refer each row index.
widgetVar String false generated ('widget_' + componentClientId) Name of the client side widget.
var String true Name of the iterator variable that references each element in the data set.
rows int false 0 Number of rows to display per page. Default value is 0 meaning to display all data available.
paginatorPosition String false bottom Position of the paginator.
gridRowStyleClass String false Style class of each row (grid-cell) in grid layout.
styleClass String false Style class of the component.
currentPageReportTemplate String false ({currentPage} of {totalPages}) Template of the currentPageReport UI.
paginatorTemplate String false {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown} Template of the paginator.
rowsPerPageTemplate String false Template of the rowsPerPage dropdown.
emptyMessage String false i18n Text to display when there is no data to display.
rowTitle String false Title for each row.
id String false generated Unique identifier of the component in a namingContainer.
flex Boolean false Use modern FlexGrid CSS for this component.
multiViewState boolean false false Whether to keep component state across views.
Loading...
Tag Documentation Documentation Documentation JSDoc Basic MultiViewState Lazy Responsive
p-button
p-button
  • Name
    Maisha G Saylors
    Country
    United Kingdom
    Company
    Dorl, James J Esq
    Representative
    Bernardo Dominic
  • Name
    David R Glick
    Country
    Australia
    Company
    Chanay, Jeffrey A Esq
    Representative
    Ioni Bowcher
  • Name
    Alejandro H Paprocki
    Country
    Canada
    Company
    King, Christopher A Esq
    Representative
    Ivan Magalhaes
  • Name
    Isabel Y Stenseth
    Country
    Russia
    Company
    Buckley Miller Wright
    Representative
    Xuxue Feng
  • Name
    Aika N Chui
    Country
    Argentina
    Company
    Commercial Press
    Representative
    Onyama Limba
  • Name
    Costa G Wieser
    Country
    Japan
    Company
    Buckley Miller Wright
    Representative
    Ioni Bowcher
  • Name
    Stacey S Wieser
    Country
    Argentina
    Company
    Feltz Printing Service
    Representative
    Amy Elsner
  • Name
    Leon N Flosi
    Country
    Germany
    Company
    Feiner Bros
    Representative
    Amy Elsner
  • Name
    Claire M Stockham
    Country
    Germany
    Company
    Dorl, James J Esq
    Representative
    Amy Elsner
  • Name
    Tony G Paprocki
    Country
    Japan
    Company
    Feltz Printing Service
    Representative
    Ivan Magalhaes
  • Name
    Costa I Wieser
    Country
    Spain
    Company
    Buckley Miller Wright
    Representative
    Ivan Magalhaes
  • Name
    Mayumi J Nestle
    Country
    Brazil
    Company
    Chanay, Jeffrey A Esq
    Representative
    Onyama Limba

Usage


<div class="card">
    <h:form id="form">
        <p:dataView var="customer" value="#{dtLazyView.lazyModel}" rows="12" paginator="true"
                    rowsPerPageTemplate="6,12,16"
                    paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">

            <p:dataViewGridItem>
                <div class="card">
                    <div class="grid">
                        <div class="col-12 sm:col-4 pb-0 sm:pb-2 text-secondary">
                            <h:outputText value="Name"/>
                        </div>
                        <div class="col-12 sm:col-8">
                            <h:outputText value="#{customer.name}"/>
                        </div>
                        <div class="col-12 sm:col-4 pb-0 sm:pb-2 text-secondary">
                            <h:outputText value="Country"/>
                        </div>
                        <div class="col-12 sm:col-8">
                            <span class="flag flag-#{customer.country.code}"
                                    style="width: 30px; height: 20px"/>
                            <h:outputText style="vertical-align: middle; margin-left: .5rem"
                                            value="#{customer.country.name}"/>
                        </div>
                        <div class="col-12 sm:col-4 pb-0 sm:pb-2 text-secondary">
                            <h:outputText value="Company"/>
                        </div>
                        <div class="col-12 sm:col-8">
                            <h:outputText value="#{customer.company}"/>
                        </div>
                        <div class="col-12 sm:col-4 pb-0 sm:pb-2 text-secondary">
                            <h:outputText value="Representative"/>
                        </div>
                        <div class="col-12 sm:col-8">
                            <p:graphicImage name="images/avatar/#{customer.representative.image}"
                                            library="demo"
                                            width="32" style="vertical-align: middle"/>
                            <h:outputText style="vertical-align: middle; margin-left: .5rem"
                                            value="#{customer.representative.name}"/>
                        </div>
                    </div>
                </div>
            </p:dataViewGridItem>

            <p:dataViewListItem>
                <div class="py-3">
                    <div class="grid">
                        <div class="col-12 sm:col-4 pb-0 sm:pb-2 text-secondary">
                            <h:outputText value="Name"/>
                        </div>
                        <div class="col-12 sm:col-8">
                            <h:outputText value="#{customer.name}"/>
                        </div>
                        <div class="col-12 sm:col-4 pb-0 sm:pb-2 text-secondary">
                            <h:outputText value="Country"/>
                        </div>
                        <div class="col-12 sm:col-8">
                            <span class="flag flag-#{customer.country.code}"
                                  style="width: 30px; height: 20px"/>
                            <h:outputText style="vertical-align: middle; margin-left: .5rem"
                                          value="#{customer.country.name}"/>
                        </div>
                        <div class="col-12 sm:col-4 pb-0 sm:pb-2 text-secondary">
                            <h:outputText value="Company"/>
                        </div>
                        <div class="col-12 sm:col-8">
                            <h:outputText value="#{customer.company}"/>
                        </div>
                        <div class="col-12 sm:col-4 pb-0 sm:pb-2 text-secondary">
                            <h:outputText value="Representative"/>
                        </div>
                        <div class="col-12 sm:col-8">
                            <p:graphicImage name="images/avatar/#{customer.representative.image}"
                                            library="demo"
                                            width="32" style="vertical-align: middle"/>
                            <h:outputText style="vertical-align: middle; margin-left: .5rem"
                                          value="#{customer.representative.name}"/>
                        </div>
                    </div>
                </div>
            </p:dataViewListItem>
        </p:dataView>
    </h:form>
</div>