Workaround for disclosed af:query issue on ADF 12.2.1

Michael KoniotakisOracle ADF 1 Comment

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
Latest posts by Michael Koniotakis (see all)
Subscribe
Notify of
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Mohammad Hassonah
Mohammad Hassonah
August 8, 2018 18:34

Hello Michael, Thank you for this solution, as I have not found anyone else addressing this issue. I would like to share with you another solution that I have come up with: You can leave the af:query “disclosed” property set to “true” and put it inside an af:panelBox to have the same effect. Now, to remove the unwanted little disclosure component left from the af:query with the title row containing it, you should notice that the af:panelBox will be displayed as a “div” in html source, and the undesired title row will be displayed as a “table” with an auto-generated… Read more »