Workaround for disclosed af:query issue on ADF 12.2.1

Michael Koniotakis Oracle 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

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)

1
Leave a Reply

avatar
1 Comment threads
0 Thread replies
1 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
Mohammad Hassonah Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Mohammad Hassonah
Guest
Mohammad Hassonah

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 »