Such a problem, I work in Oracle JDeveloper, version 12.2.1.0.0 I have implemented a global search across all database tables. There are search fields i.e. search options. When I make a search query by parameters, records are returned to me - everything is fine. When I sort these records by some field and click reset search parameters, why the query does not work correctly and instead of just clearing the search parameters, it also displays all records from all tables. How to fix it? The code for my reset method is shown below.
Bean class:
public void gsearchQueryOperationListener(QueryOperationEvent queryOperationEvent){
if(queryOperationEvent.getOperation().name().toUpperCase().equals("RESET")){
ViewObject object = ADFUtils.findIterator("GeneralSearchV1Iterator").getViewObject();
object.executeEmptyRowSet();
oracle.jbo.ViewCriteria criteria = ADFUtils.findIterator("GeneralSearchV1Iterator").getViewCriteria();
object.applyViewCriteria(criteria);
result = false;
}
}
.jsff class
<af:panelGroupLayout id="pgl1">
<!--<af:panelHeader text="Global search" id="ph1"/>-->
<af:query id="gsearchQ" headerText="Global search" disclosed="true"
value="#{bindings.GeneralSearchVCriteriaQuery.queryDescriptor}"
model="#{bindings.GeneralSearchVCriteriaQuery.queryModel}"
queryListener="#{pageFlowScope.GSearchBean.gsearchQueryListener}"
queryOperationListener="#{pageFlowScope.GSearchBean.gsearchQueryOperationListener}"
partialTriggers="::t1:c4 ::t1:c18 ::t1"
saveQueryMode="hidden" maxColumns="2" rows="3" modeChangeVisible="false" resultComponentId="::t1"/>
<!--queryListener="#{pageFlowScope.GSearchBean.gsearchQueryListener}"-->
<!--queryOperationListener="#{pageFlowScope.GSearchBean.gsearchQueryOperationListener}"-->
<af:table value="#{bindings.GeneralSearchV1.collectionModel}" var="row"
rows="#{bindings.GeneralSearchV1.rangeSize}" fetchSize="#{bindings.GeneralSearchV1.rangeSize}"
emptyText="" id="t1"
autoHeightRows="10" rowBandingInterval="0" styleClass="AFStretchWidth" columnStretching="last"
disableColumnReordering="true" scrollPolicy="page">
I tried to somehow fix it, but I did not succeed. Here is my code which i have tried
public void gsearchQueryOperationListener(QueryOperationEvent queryOperationEvent){
if(queryOperationEvent.getOperation().name().toUpperCase().equals("RESET")){
log.info("STEP 1:");
ViewObject object = ADFUtils.findIterator("GeneralSearchV1Iterator").getViewObject();
RichQuery queryComp1 = (RichQuery) UIComponentUtil.findComponent("gsearchQ");
log.info("queryComp1.getAttributeChangeListeners(); "+queryComp1.getAttributeChangeListeners());
queryComp1.setValue(null);
RichTable queryComp2 = (RichTable) UIComponentUtil.findComponent("t1");
log.info("queryComp2.getAttributeChangeListeners(); "+queryComp2.getAttributeChangeListeners());
log.info("queryComp2.getSelectedRowKeys(); "+queryComp2.getSelectedRowKeys());
queryComp2.getSelectedRowKeys().clear();
queryComp2.setSelectedRowKeys(null);
queryComp2.setValue(null);
queryComp2.getSelectedRowKeys().clear();
queryComp2.setSelectedRowKeys(null);
AdfFacesContext.getCurrentInstance().addPartialTarget(queryComp2);
object.setOrderByClause(null);
object.setSortBy(null);
object.executeEmptyRowSet();
oracle.jbo.ViewCriteria criteria = ADFUtils.findIterator("GeneralSearchV1Iterator").getViewCriteria();
object.applyViewCriteria(criteria);
result = false;
}