• 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

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
id String false generated Unique identifier of the component in a namingContainer.
rendered boolean false true Boolean value to specify the rendering of the component, when set to false component will not be rendered.
binding UIComponent false generated An EL expression referring to a server side UIComponent instance in a backing bean.
widgetVar String false generated ('widget_' + componentClientId) Name of the client side widget.
currentPageReportTemplate String false ({currentPage} of {totalPages}) Template of the currentPageReport UI.
emptyMessage String false i18n Text to display when there is no data to display.
first int false 0 Index of the first data to display.
flex Boolean false Use modern FlexGrid CSS for this component.
gridIcon String false Icon to display for grid layout toggle button.
gridRowStyle String false Inline style of each row (grid-cell) in grid layout.
gridRowStyleClass String false Style class of each row (grid-cell) in grid layout.
layout String false list Layout of the items, valid values are "list" and "grid".
lazy boolean false True, if the value-binding is instance of LazyDataModel. Defines if lazy loading is enabled for the data component.
listIcon String false Icon to display for list layout toggle button.
multiViewState boolean false false Whether to keep component state across views.
pageLinks int false 10 Maximum number of page links to display.
paginator boolean false false Enables pagination.
paginatorAlwaysVisible boolean false true Defines if paginator should be hidden if total data count is less than number of rows per page.
paginatorPosition String false bottom Position of the paginator.
paginatorTemplate String false {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown} Template of the paginator.
rowIndexVar String false Name of iterator to refer each row index.
rowStatePreserved boolean false false Keeps state of its children on a per-row basis.
rowTitle String false Title for each row.
rows int false 0 Number of rows to display per page. Default value is 0 meaning to display all data available.
rowsPerPageTemplate String false Template of the rowsPerPage dropdown.
style String false Inline style of the component.
styleClass String false Style class of the component.
touchable Boolean false Enable touch if supported by device. NULL uses global default or primefaces.TOUCHABLE. Default: globally enabled.
value Object true Datasource of the component.
var String true Name of the iterator variable that references each element in the data set.
Loading...
Tag DocumentationNew DocumentationNew Documentation JSDoc Basic MultiViewState Lazy Responsive
ui-button
ui-button
  • Name:Leon Q Campain
    Country: Japan
    Company:King, Christopher A Esq
    Representative:Onyama Limba
  • Name:Jones O Bowley
    Country: India
    Company:Morlong Associates
    Representative:Onyama Limba
  • Name:David B Caldarera
    Country: Argentina
    Company:Rousseaux, Michael Esq
    Representative:Onyama Limba
  • Name:Stacey W Nestle
    Country: Australia
    Company:Printing Dimensions
    Representative:Amy Elsner
  • Name:Ricardo T Butt
    Country: Russia
    Company:Benton, John B Jr
    Representative:Stephen Shaw
  • Name:Aditya T Garufi
    Country: Italy
    Company:Dorl, James J Esq
    Representative:Onyama Limba
  • Name:Sinclair B Stenseth
    Country: United Kingdom
    Company:Feltz Printing Service
    Representative:Bernardo Dominic
  • Name:Greenwood E Amigon
    Country: Brazil
    Company:Commercial Press
    Representative:Amy Elsner
  • Name:Silvio Z Waycott
    Country: Spain
    Company:Morlong Associates
    Representative:Ioni Bowcher
  • Name:Jones N Inouye
    Country: Brazil
    Company:Feiner Bros
    Representative:Onyama Limba
  • Name:Murillo J Gillian
    Country: Argentina
    Company:Chemel, James L Cpa
    Representative:Xuxue Feng
  • Name:Morrow B Oldroyd
    Country: France
    Company:Commercial Press
    Representative:Elwin Sharvill

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}"
                    gridIcon="pi pi-th-large" listIcon="pi pi-bars">

            <p:dataViewGridItem>
                <div class="card flex justify-content-center">
                    <h:panelGrid columns="2" cellpadding="7">
                        <h:outputText value="Name:" styleClass="text-secondary"/>
                        <h:outputText value="#{customer.name}"/>

                        <h:outputText value="Country:" styleClass="text-secondary"/>
                        <p:column>
                            <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}"/>
                        </p:column>

                        <h:outputText value="Company:" styleClass="text-secondary"/>
                        <h:outputText value="#{customer.company}"/>

                        <h:outputText value="Representative:" styleClass="text-secondary"/>
                        <p:column>
                            <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}"/>
                        </p:column>
                    </h:panelGrid>
                </div>
            </p:dataViewGridItem>

            <p:dataViewListItem>
                <h:panelGrid columns="2" style="width:100%" cellspacing="20">
                    <p:outputPanel>
                        <h:panelGrid columns="2" cellpadding="7">
                            <h:outputText value="Name:" styleClass="text-secondary" />
                            <h:outputText value="#{customer.name}"/>

                            <h:outputText value="Country:" styleClass="text-secondary"/>
                            <p:column>
                                <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}"/>
                            </p:column>

                            <h:outputText value="Company:" styleClass="text-secondary"/>
                            <h:outputText value="#{customer.company}"/>

                            <h:outputText value="Representative:" styleClass="text-secondary"/>
                            <p:column>
                                <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}"/>
                            </p:column>
                        </h:panelGrid>
                    </p:outputPanel>
                </h:panelGrid>
            </p:dataViewListItem>
        </p:dataView>
    </h:form>
</div>