Changing the default display of af:quickQuery using criteriaItems facet

Is there a way to change the default display of search items used in an af:quickQuery component?

Well answer is Yes. If you want to change the default display of <af:quickQuery> component you can do that by adding your own component set inside criteriaItems facet. Please check out the tag doc for <af:quickQuery> to learn more.

The below shown example may alter the quickQuery component display showing af:outputLabel for the search criteria item instead of the default drop down list. This specific example is useful when you have only one field in the the view object (a rare scenario though). Thanks to Sriram Raghavan(Oracle - ADF team) who shared this tip in an internal discussion forum :)

  <af:quickQuery label="Search" searchDesc="Search" id="qryId1"  
                  value="#{bindings.ImplicitViewCriteriaQuery.quickQueryDescriptor}"  
                  model="#{bindings.ImplicitViewCriteriaQuery.queryModel}"  
                  queryListener="#{bindings.ImplicitViewCriteriaQuery.processQuery}">  
      <f:facet name="end">  
           <af:commandLink text="Advanced" rendered="true" id="cl1"/>  
      </f:facet>  
      <f:facet name="criteriaItems">  
           <af:outputLabel   
           value="#{bindings.ImplicitViewCriteriaQuery.quickQueryDescriptor.currentCriterion.attribute.label}"  
           shortDesc="#{bindings.ImplicitViewCriteriaQuery.quickQueryDescriptor.currentCriterion.attribute.description}"/>  
      </f:facet>  
 </af:quickQuery>  

You can see the difference in display in the following picture. The first quickQuery displays search criteria item(s) using a drop down( which is default), whereas the second one displays the search criteria item on a label.

Comments