JARCH SHOWCASE
JARCH SHOWCASE
DataTable - Column Resize Columns can be resized in two ways, with a helper or live.

Basic Resize

Basic Resize
IdYearBrandColor
c37229b21997AudiBlack
21be12461987JaguarMaroon
62f364e21965MercedesBlue
9e105e261969MercedesMaroon
828885d61981MercedesWhite
cb2a12f31981HondaBlack
71e550831982JaguarBrown
70a8a6411984FordBlue
f7a3cefb1970AudiMaroon
43ff10041975FordYellow

Live Resize with Callback

IdYearBrandColor

Expand Mode with Grouping

ManufacturerSale Rate
SalesProfit
Last YearThis YearLast YearThis Year
Apple27%29%$ 71.487,00$ 53.928,00
Samsung63%29%$ 51.158,00$ 76.913,00
Microsoft6%48%$ 82.624,00$ 70.338,00
Philips44%18%$ 57.449,00$ 62.138,00
Sony40%0%$ 88.519,00$ 8.645,00
LG50%95%$ 64.514,00$ 66.916,00
Sharp44%57%$ 39.317,00$ 3.640,00
Panasonic97%74%$ 81.921,00$ 5.173,00
HTC77%28%$ 16.364,00$ 23.616,00
Nokia36%16%$ 88.365,00$ 92.440,00
Totals:$641.718$463.747
<a:form id="form">
    <a:growl id="msgs" showDetail="true" />

    <h3 style="margin-top:0">Basic Resize</h3>
    <a:dataTable id="cars1" var="car" value="#{dtResizableColumnsView.cars1}" resizableColumns="true" style="margin-bottom:20px">
        <f:facet name="header">
            Basic Resize
        </f:facet>
        <a:column headerText="Id">
            <h:outputText value="#{car.id}" />
        </a:column>
        <a:column headerText="Year">
            <h:outputText value="#{car.year}" />
        </a:column>
        <a:column headerText="Brand">
            <h:outputText value="#{car.brand}" />
        </a:column>
        <a:column headerText="Color">
            <h:outputText value="#{car.color}" />
        </a:column>
    </a:dataTable>

    <h3>Live Resize with Callback</h3>
    <a:dataTable id="cars2" var="car" value="#{dtResizableColumnsView.cars2}" resizableColumns="true" liveResize="true" style="margin-bottom:20px">
        <a:ajax event="colResize" update=":form:msgs" listener="#{dtResizableColumnsView.onResize}" />
        <f:facet name="header">

        </f:facet>
        <a:column headerText="Id" id="id">
            <h:outputText value="#{car.id}" />
        </a:column>
        <a:column headerText="Year" id="year">
            <h:outputText value="#{car.year}" />
        </a:column>
        <a:column headerText="Brand" id="brand">
            <h:outputText value="#{car.brand}" />
        </a:column>
        <a:column headerText="Color" id="color">
            <h:outputText value="#{car.color}" />
        </a:column>
    </a:dataTable>

    <h3>Expand Mode with Grouping</h3>
    <a:dataTable var="sale" value="#{dtGroupView.sales}" resizableColumns="true" resizeMode="expand">
        <f:facet name="header">

        </f:facet>

        <a:columnGroup type="header">
            <a:row>
                <a:column rowspan="3" headerText="Manufacturer" />
                <a:column colspan="4" headerText="Sale Rate" />
            </a:row>
            <a:row>
                <a:column colspan="2" headerText="Sales" />
                <a:column colspan="2" headerText="Profit" />
            </a:row>
            <a:row>
                <a:column headerText="Last Year" />
                <a:column headerText="This Year" />
                <a:column headerText="Last Year" />
                <a:column headerText="This Year" />
            </a:row>
        </a:columnGroup>

        <a:column>
            <h:outputText value="#{sale.manufacturer}" />
        </a:column>
        <a:column>
            <h:outputText value="#{sale.lastYearProfit}%" />
        </a:column>
        <a:column>
            <h:outputText value="#{sale.thisYearProfit}%" />
        </a:column>
        <a:column>
            <h:outputText value="#{sale.lastYearSale}">
                <f:convertNumber type="currency" currencySymbol="$" />
            </h:outputText>
        </a:column>
        <a:column>
            <h:outputText value="#{sale.thisYearSale}">
                <f:convertNumber type="currency" currencySymbol="$" />
            </h:outputText>
        </a:column>

        <a:columnGroup type="footer">
            <a:row>
                <a:column colspan="3" style="text-align:right" footerText="Totals:" />
                <a:column footerText="$#{dtGroupView.lastYearTotal}" />

                <a:column footerText="$#{dtGroupView.thisYearTotal}" />
            </a:row>
        </a:columnGroup>
    </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.