1

Getting this popup every time whenever calling a bean method via valueChangeListener property from SelectOneChoice in a jsff page.

I need help to block this unwanted popup.

SelectOneChoice's property of the .jsff page:

                     <af:selectOneChoice value="................."
                                        label=".................."
                                        required="..............."
                                        shortDesc=".............." 
                                        id="....................."
                                        valueChangeListener="#{TransferWorkAreaBean.onBookLovChange}"
                                        autoSubmit="true">
                       <f:selectItems value="............" id="si2"/>
                       <f:validator binding="......."/>
                    </af:selectOneChoice>

Method in Bean Class::

 public void onBookLovChange(ValueChangeEvent valueChangeEvent) {                 
    valueChangeEvent.getComponent().processUpdates(FacesContext.getCurrentInstance());
    invokeELMethod("#{bindings.methodToExecute.execute}", new Class[0], new Object[0]);
    AdfFacesContext.getCurrentInstance().addPartialTarget(getBusinessTable());
}

Method details of binding Method::

 public void executeInvetoryQueryOnBookChange(String btg) {
        OAViewObjectImpl vo = getBusinessOverview();
        VariableValueManager vvm = vo.ensureVariableManager();
        vvm.setVariableValue("bindBookTypeCode", btg);
        vo.executeQuery();
    }

Please note, in some places I have used encrypted data for policy.

Please also note, that the uncommittedDataWarning property is not ENABLED.

Papai from BEKOAIL
  • 1,469
  • 1
  • 11
  • 17

1 Answers1

1

This popup only appear when the option uncommittedDataWarning is set to "on" at the root af:document tag. Try to run a full search in your JDevelopper for "uncommittedDataWarning".

Another way of avoiding this popup in this specific case would be to ensure that your data are committed or rollback in your data model. As the popup only appear if some data aren't committed when a user navigate outside the af:document. You could run something like so right before your

invokeELMethod("#{bindings.methodToExecute.execute}", new Class[0], new Object[0]);

How to commit if needed (https://cedricleruth.com/how-to-programmatically-commit-or-rollback-a-transaction-in-oracle-adf/)

private void commitIfDirty() {
    try {
        ViewObject vo = this.getViewObjectFromIterator("YOUR_ITERATOR_NAME");
        boolean isNotSaved = vo.getApplicationModule()
                               .getTransaction()
                               .isDirty();
        if (isNotSaved) {
            vo.getApplicationModule()
              .getTransaction()
              .validate();
            vo.getApplicationModule()
              .getTransaction()
              .commit();
        }
    } catch (ValidationException validationException) {
        //log it and warn the user that his data isn't valid
    } catch (Exception error) {
        //log it and warn the user something went wrong
    }
}

private ViewObjectImpl getViewObjectFromIterator(String nomIterator) {
    ViewObjectImpl returnVO = null;
    DCBindingContainer dcb = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    if (dcb != null) {
        DCIteratorBinding iter = dcb.findIteratorBinding(nomIterator);
        if (iter != null) {
            returnVO = (ViewObjectImpl)iter.getViewObject();
        }
    }
    return returnVO;
}
Cedric
  • 977
  • 2
  • 11
  • 23
  • Upvoted!! It's true that if a transaction becomes dirty, any changes on LOV/VO may pops up this warning. But I think, this is not a good idea to commit/rollback the entire transaction, looking for any other alternative. – Papai from BEKOAIL Jul 28 '22 at 06:02
  • Anyway, if you have this popup, it's because you have the uncommittedDataWarning="on” in your root document tag. It can't happen otherwise. – Cedric Jul 28 '22 at 06:47