Hope Everyone knows about the list of values and autoSuggest beahvior 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 framework can look at this post
ADF Basics : Implementing auto suggest behavior in ADF Faces lov (list of values)
By default autoSuggest search beahvior is “STARTSWITH” means when user types any string in input part of lov then framework shows all suggestion that starts with input string
Now requirement is to change default behavior of autoSuggest search so for this I have googled it and found two wonderful post 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 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 blogposts it is mentioned that framework executes a view criteria named __lov__filterlist__vcr___ to retrieve suggested values so to override this viewCirteria create ViewObjectImpl class of Departments ViewObject (LOV ViewObject) and override applyViewCriteria method and used 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 same input it shows all that suggested values that contains ‘S’
In 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