PrimeFaces

PrimeFaces Dialog Framework

Settings

Add below lines to faces-config.xml for activating PrimeFaces Dialog Framework

<application>
    <action-listener>org.primefaces.application.DialogActionListener</action-listener>
    <navigation-handler>org.primefaces.application.DialogNavigationHandler</navigation-handler>
    <view-handler>org.primefaces.application.DialogViewHandler</view-handler>
</application>

Object parameters to Dialog Framework (Method1)

<p:commandLink value="#{rfx.seller.fullname}" action="#{tenderView.viewQuotation}" rendered="false">
    <f:setPropertyActionListener value="#{rfx.seller}" target="#{tenderView.selectedSeller}"/>
</p:commandLink>
public void viewQuotation() {
    QuotationEntity quotation = quotationService.findOneByTenderAndUser(selectedRecord, selectedSeller);

    Map<String, Object> options = new HashMap<>();
    options.put("modal", true);
    options.put("width", 640);
    options.put("height", 340);
    options.put("closeOnEscape", true);
    options.put("contentWidth", "100%");
    options.put("contentHeight", "100%");

    final Map<String, List<String>> params = new HashMap<>();
    params.put("id", Collections.singletonList(quotation.getId().toString()));

    PrimeFaces.current().dialog().openDynamic("/buyer/quotation/showDialog", options, params);
}

Object parameters to Dialog Framework (Method2)

<p:commandLink value="#{rfx.seller.fullname}" action="#{tenderView.viewBafo(seller)}" rendered="false"/>
public void viewBafo(UserEntity seller) {
    QuotationEntity bafo = quotationService.findOneByTenderAndUser(selectedRecord, seller);

    Map<String, Object> options = new HashMap<>();
    options.put("modal", true);
    options.put("width", 640);
    options.put("height", 340);
    options.put("closeOnEscape", true);
    options.put("contentWidth", "100%");
    options.put("contentHeight", "100%");

    final Map<String, List<String>> params = new HashMap<>();
    params.put("id", Collections.singletonList(bafo.getId().toString()));

    PrimeFaces.current().dialog().openDynamic("/buyer/bafo/showDialog", options, params);
}

onCellEdit get row object and update cell

public void onCellEdit(CellEditEvent event) {
    Entity response = (Entity) ((DataTable) event.getComponent()).getRowData();

    Integer oldValue = (Integer) event.getOldValue();
    Integer newValue = (Integer) event.getNewValue();

    if (newValue != null && !newValue.equals(oldValue)) {
        service.update(entity);
    }
}

PrimeFaces galleria redirect onclick using remoteCommand