Ashish Sahu
Ashish Sahu

Reputation: 31

Oracle ADF or Java

I am using ADF autoSuggestBehavior to show list of values. But the problem is it is showing only the values that start with the typed character, I want to show all the results that contain that specific character.

Example - If there is a list of country and you type U, it will suggest for countries starting with U. But what I want is to show all the countries that contains the letter U it may be the starting character or ending character.

Please suggest any solution either in JAVA or ADF.

Upvotes: 2

Views: 331

Answers (1)

Ashish Awasthi
Ashish Awasthi

Reputation: 83

Go to the ViewObjectImpl class of the ViewObject on the basis of whome LOV is made and paste the following code.

applyViewCriteria(ViewCriteria, boolean) is invoked in case of autosuggest and overriding this method will solve your problem

@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;
    }

Upvotes: 1

Related Questions