Hope Everyone knows about the list of values and autoSuggest behavior of ADF Framework, In this post I’ll show you how to implement contains or ends with behavior in autosuggest.
For those who are new to the framework can look at this post
ADF Basics: Implementing auto suggest behavior in ADF Faces lov (list of values)
By default autoSuggest search behavior is “STARTSWITH” means when a user types any string in input part of lov then framework shows all suggestion that starts with the input string
Now the requirement is to change the default behavior of autoSuggest search so for this I have googled it and found two wonderful posts of Andrejus Baranovskis (Thanks)
These both post talk about another problem with lovs that opens search popup for suggested values and Andrejus uses a solution that overrides lov view criteria operator to not to show any suggested values.
I have used the same method to override lov auto-suggestion view criteria operator to implement contains behavior
Here I have applied Departments Lov on Employee viewObject’s Department Id attribute and default autoSuggest behavior is like this
In the above blog posts, it is mentioned that framework executes view criteria named __lov__filterlist__vcr___ to retrieve suggested values so to override this view criteria create ViewObjectImpl class of Departments ViewObject (LOV ViewObject) and override applyViewCriteria method and used the same method to override lov operator
See this code here I am using CONTAINS operator in place of STARTSWITH
And see how this works, For the same input, it shows all that suggested values that contains ‘S’
In the same way, we can implement other operators too, just replace CONTAINS with ENDSWITH and see the result
Cheers 🙂 Happy Learning
An Oracle ACE, Blogger, Reviewer, Technical Lead working on Oracle ADF