Follow by Email

Wednesday, 4 June 2014

ADF Basics : Implementing auto suggest behavior in ADF Faces lov (list of values)


Auto Suggest behavior is best understand by Google Instant, as in google when we type something and it starts showing suggestion instantly.

 This effect can be implemented in ADF using autoSuggestBehaviour
To use the auto-suggest functionality in a declarative way you need to define a model-driven list of values on your model project, which will be the base for the suggestedItems list. Select the Department Name attribute from the Department VO and create a List of Values. here i am using HR schema and predefined table Department to implement this

  • Create a Fusion Web Application
  • Now create EO and VO of Department table.(Business Components)


  • Now create List of values(LOVs)on DepartmentName



  • Create page in ViewController and drag the DepartmentName on page as ADF Lov ChoiceList or Lov Input

  • Now go to Component Palette and select Auto Suggest Behaviour and drop it inside DepartmentName Lov


  • Now select af:autoSuggestBehavior from Page structure and go to PropertyInspector and Open Expression Builder at SuggestedItems and select from bindings #{bindings.DepartmentName.suggestedItems} if you are using different tables and Lov select according to that



  • Now run your page and enjoy autosuggest behavior (ADF Instant) 
Cheers :-) Happy Learning

Read Next Post in Series- Implement contains/endswith behavior in model based autoSuggest Lov (Input list and combo box)

14 comments :

  1. i did as like this but am not getting anything under bindings in method expression builder

    ReplyDelete
    Replies
    1. Hi Latha

      When you drop an attribute as input lov then it's binding is created in page def and that binding appears in expression builder
      Which Jdev version you are using ?
      Go to binding section of page and check that input lov binding is created or not

      Ashish

      Delete
    2. Thank You Ashish. I rectified the error. I am using this in ADF Table so instead of bindings i should choose row.bindings.

      Delete
  2. Hello, i can't find suggestedItems behind labels node? can you help me?

    ReplyDelete
    Replies
    1. First drop autoSuggestBehavior tag in lov then check it in bindings and expand associated lov binding , there you will see suggestedItems

      Delete
  3. Hello, no suggestedItems is there inside bindings. in Jdev 11.1.1.7 version...please check and help.

    ReplyDelete
  4. Hello Ashish,
    Dynamic List always dimmed when I tring to drop departmentId as input List Of Values, I use J developer 11.2.4, Any suggest?

    ReplyDelete
  5. Hi Ashish,

    If input LOV is a column inside table, then I am not getting suggestItems from bindings corresponds to particular row.
    Th code will be like this for inputLOV inside table:










    Here it is throwing an error:

    suggestItems="#{row.bindings.PenTypVal.suggestedItems}": Method not found:



    Could you please help, how to get the suggested list of items inside table.?

    Thanks in advance,
    Manoj

    ReplyDelete
    Replies
    1. You need to refer lov model from outside of table , add lov binding to page and then use #{bindings.PenTypVal.suggesteditems} referring that LOV Binding

      Delete
  6. Hi Ashish,

    There is an attribute to set maxSuggestedItems where we can set max No of suggested Items

    Is there a way to set min suggested items to some 20 if available

    ReplyDelete
    Replies
    1. No there is no way and why you need that Chaitanya ?
      If there is any record in list then it'll appear on page , No need to set minimum number

      Ashish

      Delete
  7. Hi Aashish,

    My scenario is such that I have viewobject MaterVO and I have another VO lovVO from which LOV values are fetched. lovVO returns two values id and name. Now if i create LOV on one attribute of MasterVO let suppose as as name and store id in backend db o form submit but display name from lovVO then auto suggest behaviour is working if search for ids and not for names.

    ReplyDelete
    Replies
    1. Hi Ashish,

      This worked fine. Thanks for the support.

      Delete