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
Czech
Greek
Persian
Finnish
Danish
Hindi
Indonesian
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
Vietnamese
Chinese
Chinese

Input Style

Themes

PrimeOne
Saga Saga
Vela Vela
Arya Arya
Bootstrap
bootstrap4-blue-light Bootstrap Blue
bootstrap4-purple-light Bootstrap Purple
bootstrap4-blue-dark Bootstrap Blue
bootstrap4-purple-dark Bootstrap Purple
Material Design
material-indigo-light Indigo
material-deeppurple-light' Deep Purple
material-indigo-dark Indigo
material-deeppurple-dark' Deep Purple
Material Design Compact
material-indigo-light Indigo
material-deeppurple-light' Deep Purple
material-indigo-dark Indigo
material-deeppurple-dark' Deep Purple

DragDrop Custom

This sample demonstrates how to extend PrimeFaces with javascript. Tree component displays the available columns which are draggable. where as column headers have drop targets and dropping a treenode onto one of these adds the related property column to the datatable. Column headers can also be moved back to the tree.

  • Columns
CODENAMEQUANTITY
f230fh0g3Bamboo Watch24
nvklal433Black Watch61
zz21cz3c1Blue Band2
244wgerg2Blue T-Shirt25
h456wer53Bracelet73
av2231fwgBrown Purse0
bib36pfvmChakra Bracelet5
mbvjkgip5Galaxy Earrings23
vbb124btrGame Controller2

<style>
    .active-drop {
        background-color: var(--primary-color);
    }

    .highlight-drop {
        background-color: var(--primary-color);
    }
</style>
<script>
    function initDND() {
        $('.ui-treenode-leaf').draggable({
            helper: 'clone',
            scope: 'treetotable',
            zIndex: ++PrimeFaces.zindex
        });

        $('.ui-datatable .droppoint').droppable({
            activeClass: 'active-drop',
            hoverClass: 'highlight-drop',
            tolerance: 'pointer',
            scope: 'treetotable',
            drop: function (event, ui) {
                var property = ui.draggable.find('.ui-treenode-label').text(),
                    droppedColumnId = $(this).parents('th:first').attr('id'),
                    dropPos = $(this).hasClass('dropleft') ? 0 : 1;

                treeToTable([
                    {name: 'property', value: property}
                    , {name: 'droppedColumnId', value: droppedColumnId}
                    , {name: 'dropPos', value: dropPos}
                ]);
            }
        });

        $('.ui-datatable th').draggable({
            scope: 'tabletotree',
            helper: function () {
                var th = $(this);

                return th.clone().appendTo(document.body).css('width', th.width());
            }
        });

        $('.ui-tree').droppable({
            helper: 'clone',
            scope: 'tabletotree',
            activeClass: 'active-drop',
            hoverClass: 'highlight-drop',
            tolerance: 'touch',
            drop: function (event, ui) {
                tableToTree([
                    {name: 'colIndex', value: ui.draggable.index()}
                ]);
            }
        });
    }

    $(function () {
        initDND();
    });
</script>

<div class="card">
    <h:form id="form">
        <p:remoteCommand name="treeToTable" action="#{columnManagerView.treeToTable}" update="tree products"
                         oncomplete="initDND()"/>
        <p:remoteCommand name="tableToTree" action="#{columnManagerView.tableToTree}" update="tree products"
                         oncomplete="initDND()"/>

        <p:tree id="tree" value="#{columnManagerView.availableColumns}" var="column" style="margin-bottom:20px">
            <p:treeNode>
                <h:outputText value="#{column}"/>
            </p:treeNode>

            <p:treeNode type="column" icon="pi pi-ellipsis-v">
                <h:outputText value="#{column.property}"/>
            </p:treeNode>
        </p:tree>

        <p:dataTable id="products" var="product" value="#{columnManagerView.products}">
            <p:columns value="#{columnManagerView.columns}" var="column">
                <f:facet name="header">
                    <h:outputText style="float:left;display:block;height:20px;width:10px;border:0 none;"
                                  styleClass="droppoint dropleft"/>
                    <h:outputText style="float:right;display:block;height:20px;width:10px;border:0 none;"
                                  styleClass="droppoint dropright"/>
                    <h:outputText value="#{column.header}"/>
                </f:facet>

                <h:outputText value="#{product[column.property]}"/>
            </p:columns>
        </p:dataTable>
    </h:form>
</div>