Workaround for disclosed af:query issue on ADF 12.2.1

Michael Koniotakis Oracle ADF 0 Comments

While migrating ADF applications from 11 to 12 we stepped on a known bug in ADF 12.2.1

Bug 22469635 : AF:QUERY COMPONENT BUTTONS DON’T WORK WHEN “DISCLOSED” SET TO “FALSE”

Since this is not resolved yet we needed a workaround.

There were search criteria with disclosed=”false” in pages with rich layout that the user should expand it only if he wanted to search. So, having them disclosed=”true” would affect the layout greatly.

An option would be to surround the af:query with a disclosed panel box. Yet this would still affect the layout and would not look pretty.

We noticed that after we expand the af:query the functionality is restored if a resetActionListener were executed (e.g. with a rollback button).

Workaround:

We added a hidden button with a reset action listener and a javascript to be executed on the disclosure listener of the af:query.

  • The button on the page:
<af:button text="reset" id="resetb1" immediate="true" partialSubmit="false" visible="false">
<af:resetActionListener/>
</af:button>
  • The javascript:
function resetQuery(event) {
    var cmd= AdfPage.PAGE.findComponentByAbsoluteId("t:resetb1");
    if (cmd!= null) {
        var actionEvent = new AdfActionEvent(cmd);
        actionEvent.noResponseExpected();
        actionEvent.queue();
    }
}
  • In the af:query add the disclosureListener=”#{bean.disclose}”
  • and in the managed bean:
public void disclose(DisclosureEvent disclosureEvent) {
    if (disclosureEvent.isExpanded())   {
        ExtendedRenderKitService service = org.apache.myfaces.trinidad.util.Service.getRenderKitService(JSFUtils.getFacesContext(), ExtendedRenderKitService.class);
        service.addScript(JSFUtils.getFacesContext(), "resetQuery();");
    }
}
Michael Koniotakis

Michael Koniotakis

I am in software development business for more than 15 years. I have been to all positions from Junior Developer to Project Manager. I am a partner in Nodalpoint Systems, and nominated with the Oracle ACE title on 2010.
Michael Koniotakis

Latest posts by Michael Koniotakis (see all)

Leave a Reply

Be the First to Comment!

Notify of
avatar
wpDiscuz