When using Primefaces Row editor, how to prevent from going to the next row for update without saving or cancelling a previous row update?

Viewed 25

When using PrimeFaces Row editor, how to prevent from going to the next row for update without saving or cancelling a previous row update? Is there anything in PrimeFaces to allow a pop-up a message to be displayed forcing user to click a check mark to accept the update or click "x" mark to cancel it, before proceeding to the next row?

This what we have for row editing:

<p:ajax event="rowEdit"
listener="#{orderBean.orderProductEquipmentBean.onRowEditCpeFinancialSelectListener}"
update="orderEquipmentFinancialListTable" />

<p:ajax event="rowEditCancel"
listener="#{orderBean.orderProductEquipmentBean.onRowCancelCpeFinancialSelectListener}"
update="orderEquipmentFinancialListTable" />
public void onRowEditCpeFinancialSelectListener(RowEditEvent<OrderComponentFinancialDetail> event) {

    OrderComponentFinancialDetail selectedCpeFinancialDetail = event.getObject();
    if (selectedCpeFinancialDetail.getId() != null) {
        this.getOrderService().updateCpeFinancialDetail(this.processCpeMultiSelectionFinancialDetails(selectedCpeFinancialDetail));

        this.getOrderComponentFinancialDetails();
        this.addMessage(FacesMessage.SEVERITY_INFO, "CPE Updated", "Order Component CPE Financial" + selectedCpeFinancialDetail.getEventType() + " updated");
    }
}

private BigDecimal calculateNetPrice(OrderComponentFinancialDetail financialDetail) {

    if ((financialDetail.getPercentDiscount() != null) && (financialDetail.getPercentDiscount().compareTo(Constants.BIG_DECIMAL_ZERO) == 0) && ((financialDetail.getManufacturerPercentageDiscount() != null) && (financialDetail.getManufacturerPercentageDiscount().floatValue() != 0)))
        return (financialDetail.getListPrice().subtract(financialDetail.getListPrice().multiply(financialDetail.getManufacturerPercentageDiscount().divide(Constants.BIG_DECIMAL_ONE_HUNDRED)))).setScale(2, RoundingMode.HALF_UP);
    else if ((financialDetail.getChargeAmount() != null) && (financialDetail.getPercentDiscount() != null) && (financialDetail.getChargeAmount().compareTo(Constants.BIG_DECIMAL_ZERO) == 0) && (financialDetail.getPercentDiscount().compareTo(Constants.BIG_DECIMAL_ZERO) == 0) && ((financialDetail.getManufacturerPercentageDiscount() != null) && (financialDetail.getManufacturerPercentageDiscount().compareTo(Constants.BIG_DECIMAL_ZERO) == 0)))
        return financialDetail.getListPrice();
    else
        return (financialDetail.getListPrice().subtract(financialDetail.getListPrice().multiply(financialDetail.getPercentDiscount().divide(Constants.BIG_DECIMAL_ONE_HUNDRED)))).setScale(2, RoundingMode.HALF_UP);

}
0 Answers
Related