JARCH SHOWCASE
JARCH SHOWCASE
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
IDYEARBRAND
db46525c1997Renault
8bbb7c431969Fiat
dd4136311980Ford
93561e1e1987Mercedes
7c26b34e1968Renault
4bf98d561981BMW
9f1bc2af1981Honda
c437af321965Honda
8a7088741965Renault
<a:form id="form">
    <a:remoteCommand name="treeToTable" actionListener="#{columnManagerView.treeToTable}" update="tree cars" oncomplete="initDND()"/>
    <a:remoteCommand name="tableToTree" actionListener="#{columnManagerView.tableToTree}" update="tree cars" oncomplete="initDND()"/>

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

        <a:treeNode type="column" icon="ui-icon-grip-dotted-vertical">
            <h:outputText value="#{column.property}" />
        </a:treeNode>
    </a:tree>

    <a:dataTable id="cars" var="car" value="#{columnManagerView.cars}">
        <a: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="#{car[column.property]}" />
        </a:columns>
    </a:dataTable>
</a:form>
                
JARCH, Copyright © 2022 All rights reserved. Running JARCH 24.3.0-SNAPSHOT on PrimeFaces-12.0.0 on Mojarra-2.3.13.