Hello all,
This post is about changing the default AutoSuggest behaviour in ADF Components.
We had a requirement to implement AutoSuggest search on "CONTAINS" basis. Normally the AutoSuggest component in ADF works on "STARTSWITH" basis but we had a requirement in which we had to implement contains search in ADF.
Whenever AutoSuggest is invoked a method applyViewCriteria(ViewCriteria, boolean) in ViewObjectImpl is called.
So to change the behaviour of AutoSuggest we have to override this method in ViewObjectImpl.
Go to the ViewObjectImpl class of the ViewObject on the basis of whome LOV is made and paste the following code.
Now, you are ready to go.
References : http://andrejusb.blogspot.in/2014/11/suppressing-adf-lov-like-operator.html
@Override public void applyViewCriteria(ViewCriteria viewCriteria, boolean b) { super.applyViewCriteria(supressStartsWithClauseForLov(viewCriteria), b); } public ViewCriteria supressStartsWithClauseForLov(ViewCriteria vc){ if(vc != null && vc.getName().contains("__lov__filterlist__vcr__")){ ViewCriteriaRow currentRow = (ViewCriteriaRow)vc.getCurrentRow(); if(currentRow != null){ List criteriaItems = currentRow.getCriteriaItems(); for(int i = 0 ; i < criteriaItems.size() ; i++){ ViewCriteriaItem object = (ViewCriteriaItem)criteriaItems.get(i); if(object != null){ System.out.println("Operator is : "+object.getOperator()); if("STARTSWITH".equals(object.getOperator())){ object.setOperator("CONTAINS"); } } } } } return vc; }
Now, you are ready to go.
References : http://andrejusb.blogspot.in/2014/11/suppressing-adf-lov-like-operator.html