JARCH SHOWCASE
JARCH SHOWCASE
DataTable - ContextMenu ContextMenu has special integration with DataTable.
RightClick to View Options
IdYearBrandColor
6e25207e1967MercedesWhite
630b69341987VolkswagenGreen
9cb017df2009HondaOrange
adb2ef981984FiatSilver
386f99aa1994MercedesBlack
ccc5882c2002VolvoOrange
73c8d94d1965VolkswagenBlack
4e1919c32003VolvoMaroon
f6fc6baa1965JaguarMaroon
bbede79b1987JaguarYellow
Car Info
<a:form id="form">
    <a:dataTable id="cars" var="car" value="#{dtContextMenuView.cars}" rowKey="#{car.id}"
                 selection="#{dtContextMenuView.selectedCar}" selectionMode="single">
        <f:facet name="header">
            RightClick to View Options
        </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>

    <a:contextMenu for="cars">
        <a:menuitem value="View" update="carDetail" icon="ui-icon-search" oncomplete="PF('carDialog').show()"/>
        <a:menuitem value="Delete" update="cars" icon="ui-icon-close" actionListener="#{dtContextMenuView.deleteCar}"/>
    </a:contextMenu>

    <a:dialog header="Car Info" widgetVar="carDialog" modal="true" showEffect="fade" hideEffect="fade" resizable="false">
        <a:outputPanel id="carDetail" style="text-align:center;">
            <a:panelGrid  columns="2" rendered="#{not empty dtContextMenuView.selectedCar}" columnClasses="label,value">
                <f:facet name="header">
                    <a:graphicImage name="demo/images/car/#{dtContextMenuView.selectedCar.brand}-big.gif"/>
                </f:facet>

                <h:outputText value="Id:" />
                <h:outputText value="#{dtContextMenuView.selectedCar.id}" />

                <h:outputText value="Year" />
                <h:outputText value="#{dtContextMenuView.selectedCar.year}" />

                <h:outputText value="Color:" />
                <h:outputText value="#{dtContextMenuView.selectedCar.color}" style="color:#{dtContextMenuView.selectedCar.color}"/>

                <h:outputText value="Price" />
                <h:outputText value="$#{dtContextMenuView.selectedCar.price}" />
            </a:panelGrid>
        </a:outputPanel>
    </a:dialog>
</a:form>
                
JARCH, Copyright © 2022 All rights reserved. Running JARCH 24.3.0-SNAPSHOT on PrimeFaces-12.0.0 on Mojarra-2.3.13.