使用自动提示行为的ADF表单自动填充

来源:互联网 发布:百度贴吧数据统计 编辑:程序博客网 时间:2024/05/29 17:49

ADF Form Autocomplete using Autosuggest behavior – Search, View, Add and/or Edit

November 3rd, 2010 | Posted by Bogdan Petridean in Oracle ADF | 12 Comments

                     <div class="entry-content">                        <p>In this blog entry we will use the <em>af:autoSuggestBehavior </em>ADF&nbsp;operation in order to enable the user to search, view, add and/or edit data in an enhanced, more professional and intelligent way.<br>

The fusion web sample application – implemented using JDeveloper IDE version 11.1.1.3.0 and built on HR database – can be downloaded from HERE

Introduction

The application uses the Employees table of HR schema in order to search, display, add and/or edit employees.

Initially, the user must enter a string representing a part of or the full first name or a part of or the full last name and with respect to the provided value a case insensitive, using CONTAINS and OR operands search is executed and a list of employees is displayed to the user.

If the user chooses an employee from the list, after focus is lost or Enter key is pressed, a popup containing the employee’s details is automatically displayed in edit mode.

If the user enters a search string that returns an empty list or the user decides not to choose an employee from the suggested list a new employee is automatically created and displayed within a popup for the user to populate.

More, for each employee the Manager attribute supports autosuggest and autcomplete behaviors as described above.

Model

Create a connection to HR database and use it to generate the Employees entity and view object:

New -> Business Tier -> ADF Business Components -> Business Components from Tables -> select EMPLOYEES table – > Entity and Updatable View Object

Next, create a view link – ManagerToEmployeeVL which will be used in order to get the manager for each employee:

Now, go to AppModule and use the above view link and view object to create the following structure:

EmployeesVO – used to CRUD employees and EmployeesVO1 – used to CRUD managers are both instances of EmployeesVO.

Next, we will configure EmployeesVO:

First, create a new transient attribute, name it ManagerName and use Groovy EL to set its value:

Second,  create a new View Criteria, name it EmployeesVOCriteria and configure it as below:

We shall use the above ViewCriteria when implementing the autosuggest and autocomplete behaviours.

Finally, in order to be able to declaratively call the EmployeesVOCriteria from an ExecuteWithParams operation binding we need to go to AppModule -> Data Model and set for EmployeesVO and EmployeesVO1 the EmployeesVOCriteria as Selected:


Business

Create a new java class, name it Autosuggest generic autosuggest helper class – and use the self explainatory code below:

?
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
public class Autosuggest {
    public Autosuggest() {
    }
 
    public static final String SPLITTER = " ";
 
    /**
     * Method that enables the developper to embellish the list of suggested items;
     * it allows him to select what item/items
     * to display within the list of suggested items
     * and also what value/values to set when an item is selected
     *
     * The valueAttrs and displayAttrs will be separatd by the separator param = SPLITTER
     *
     * Uses the value of the valueAttrNames array as the key for
     * the SelectItem key.
     *
     * @param iterName ADF iterator binding
     * @param valueAttrNames - array containing the names of value attribute to use for key.
     * If valueAttrNames.length > 1 the separator will be appended in between
     * @param displayAttrNames - array containing the names of the attribute from iterator rows to display
     * If displayAttrNames > 1 the separator will be appended in between
     * @param separator - string used in order to arrange each SelectItem
     * @return ADF Faces SelectItem for an iterator binding
     */
    public static List<SelectItem> selectItemsForIterator(String iterName,
                                                          String[] valueAttrNames,
                                                          String[] displayAttrNames,
                                                          String separator) {
 
        DCIteratorBinding iter = ADFUtils.findIterator(iterName);
        List<SelectItem> selectItems = new ArrayList<SelectItem>();
        for (Row r : iter.getAllRowsInRange()) {
            String value = "";
            for (int i = 0; i < valueAttrNames.length; i++) {
                value =
                        value + (i > 0 ? separator : "") + r.getAttribute(valueAttrNames[i]);
            }
            String name = "";
            for (int i = 0; i < displayAttrNames.length; i++) {
                name =
name + (i > 0 ? separator : "") + r.getAttribute(displayAttrNames[i]);
            }
            selectItems.add(new SelectItem(value, name));
        }
        return selectItems;
    }
 
    /**
     * Autosuggest generic method
     *
     * @param suggestedName - the search string
     * @param operationName - operation used in order to provide the list of suggested items (Ex: ExecuteWithParams)
     * @param operationParams - parameters needed by the operation identified by the operationName (Ex: ViewCriteria bind variables)
     * @param iteratorName - see selectItemsForIterator method
     * @param valueParams - see valueAttrNames param of selectItemsForIterator method
     * @param displayParams = see displayAttrNames param of selectItemsForIterator method
     * @return - parametrized list of SelectItems representing the suggested list of items
     */
    public static List<SelectItem> getSuggestedItems(String suggestedName,
                                                     String operationName,
                                                     String[] operationParams,
                                                     String iteratorName,
                                                     String[] valueParams,
                                                     String[] displayParams) {
        OperationBinding operationBinding =
            ADFUtils.findOperation(operationName);
        for (int i = 0; i < operationParams.length; i++) {
            operationBinding.getParamsMap().put(operationParams[i],
                                                suggestedName);
        }
        operationBinding.execute();
 
        List<SelectItem> suggestedItems =
            selectItemsForIterator(iteratorName, valueParams, displayParams,
                                   SPLITTER);
        return suggestedItems;
    }
 
}

Create another java class, name it EmployeeBean – it will use the generic static methods of the Autosuggest class defined above. The methods implemented within this bean will be presented with respect to the visual component for which they provide service.

Next, open adfc-config.xml -> Overview -> Managed Beans and set EmployeeBean scope to request as presented in the image below:

User Interface

Create a new JSF page, name it main.jspx and follow the steps below:

Add a new inputText:

?
1
2
3
4
5
6
7
8
<af:inputText label="Add/Edit employee using autosuggest:"
                              id="it1"
                              valueChangeListener="#{EmployeeBean.onEmployeeValueChange}"
                              autoSubmit="true"
                              binding="#{EmployeeBean.employeeInputText}"
                              columns="32">
                  <af:autoSuggestBehavior suggestedItems="#{EmployeeBean.getSuggestedEmployees}"/>
                </af:inputText>

autoSubmit is set to true in order for the valueChangeListener method to be automatically called every time a new value is entered or selected from the suggested list.
The valueChangeListener attribute points to the onEmployeeValueChange method (defined in EmployeeBean bean) that processes the user input and decides between: Add new employee and Open existing employee in edit mode:

?
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
public void onEmployeeValueChange(ValueChangeEvent valueChangeEvent) {
    if (valueChangeEvent.getNewValue() != null) {
        Map viewScope = ADFContext.getCurrent().getViewScope();
        viewScope.put("isNewEmployee", "true");
        String[] arrayValue =
            valueChangeEvent.getNewValue().toString().split(Autosuggest.SPLITTER);
        StringBuilder sb = new StringBuilder();
        if (arrayValue.length > 1) {
            try {
                Integer id = Integer.valueOf(arrayValue[0]);
                OperationBinding operationBinding =
                    ADFUtils.findOperation("ExecuteWithParamsToFilterEmployeesVOForAutosuggest");
                operationBinding.getParamsMap().put("EmployeeIdBV", id);
                operationBinding.execute();
                if (ADFUtils.findIterator("EmployeesVOIterator").getEstimatedRowCount() ==
                    1) {
                    for (int i = 1; i < arrayValue.length; i++) {
                        sb.append(arrayValue[i] +
                                  (i == arrayValue.length - 1 ? "" : " "));
                    }
                    ((RichInputText)valueChangeEvent.getComponent()).setValue(sb.toString());
                    AdfFacesContext.getCurrentInstance().addPartialTarget(getEmployeeInputText());
 
                    viewScope.put("isNewEmployee", "false");
                }
            } catch (java.lang.NumberFormatException nfe) {
                nfe.printStackTrace();
            }
        }
        if (viewScope.get("isNewEmployee").equals("true")) {
            ADFUtils.findOperation("CreateInsertEmployee").execute();
            //sync with user input
            String firstName = "";
            String lastName = "";
            if (arrayValue.length > 1) {
                for (int i = 0; i < arrayValue.length - 1; i++) {
                    sb.append(arrayValue[i] +
                              (i == arrayValue.length - 2 ? "" : " "));
                }
                firstName = sb.toString();
                lastName = arrayValue[arrayValue.length - 1];
            } else {
                firstName = arrayValue[0];
            }
            ADFUtils.setBoundAttributeValue("FirstName", firstName);
            ADFUtils.setBoundAttributeValue("LastName", lastName);
        }
 
        PopupUtils.showPopup(getPopup());
    }
}

When the inputText component fires a value change event isNewEmployee view scope attribute is initialized with its default value.  ExecuteWithParamsToFilterEmployeesVOForAutosuggest operation is executed to find the selected employee.  If an employee is found than it automatically becomes the current employee and isNewEmployee is set to false; otherwise a new employee is created and the string inserted by the user is parsed and split in order to be used for auto completion on FirstName and LastName attributes.

AutoSuggest behavior

Notice the af:autoSuggestBehavior component nested inside the inputText – in order to add it go to operations and drag&drop it onto the inputText component.

The suggestedItems attribute must point to a method that has a String parameter and returns a parametrized List of SelectItem type – getSuggestedEmployees defined in Business bean:

?
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
/**
 * This method is registered with af:autoSuggestBehavior suggestedItems tag
 * and must have the signature exactly as below
 *
 * @param suggestedName - the string with respect to which the list of suggested employees if fetched
 * @return parametrized List of SelectItem type containing the suggested employees
 */
public List<SelectItem> getSuggestedEmployees(String suggestedName) {
    return Autosuggest.getSuggestedItems(suggestedName,
                                         "ExecuteWithParamsToFilterEmployeesVOForAutosuggest",
                                         new String[] { "FirstNameBV",
                                                        "LastNameBV" },
                                         "EmployeesVOIterator",
                                         new String[] { "EmployeeId",
                                                        "FirstName",
                                                        "LastName" },
                                         new String[] { "FirstName",
                                                        "LastName" });
}

The above method uses the ExecuteWithParamsToFilterEmployeesVOForAutosuggest operation in order to acquire the employees to be loaded into the suggested list. This operation is also used in order to enable the autocomplete behavior.

Define the operation in the pageDef file (also make sure that EmployeesVOCriteria is set as Selected in AppModule -> Data Model -> EmployeesVO):

AutoComplete behavior

The autocomplete behavior is implemented using the EmployeesVOCriteria and an executeWithParams operation.

So, if an employee/manager is selected from the suggested list the ExecuteWithParamsToFilterEmployeesVOForAutosuggest/ExecuteWithParamsToFilterEmployeesVO1ForAutosuggest is executed and EmployeesVO/EmployeesVO1 is filtered accordingly.

Because the search is executed with respect to the ID (PK) the result will always consist of one row, which will be set as the current row and when the popup is opened the fields will be automatically filled out:

?
1
2
3
4
5
Integer id = Integer.valueOf(arrayValue[0]);
OperationBinding operationBinding =
    ADFUtils.findOperation("ExecuteWithParamsToFilterEmployeesVOForAutosuggest");
operationBinding.getParamsMap().put("EmployeeIdBV", id);
operationBinding.execute();

When a new employee/manager is created the autocomplete works only for First Name and Last Name fields as shown below:

?
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
//sync with user input
String firstName = "";
String lastName = "";
if (arrayValue.length > 1) {
    for (int i = 0; i < arrayValue.length - 1; i++) {
        sb.append(arrayValue[i] +
                  (i == arrayValue.length - 2 ? "" : " "));
    }
    firstName = sb.toString();
    lastName = arrayValue[arrayValue.length - 1];
} else {
    firstName = arrayValue[0];
}
//autocomplete
ADFUtils.setBoundAttributeValue("FirstName", firstName);
ADFUtils.setBoundAttributeValue("LastName", lastName);

Add/Edit functionality

Drag&Drop a new popup component into the page:

?
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<af:popup id="p1" contentDelivery="lazyUncached"
                  binding="#{EmployeeBean.popup}"
                  popupFetchListener="#{EmployeeBean.onPopupOpen}">
          <af:dialog title="#{viewScope.isNewEmployee eq 'false'?'Edit Existing Employee':'Add New Employee'}"...>
            <af:panelGroupLayout ...>
              <af:panelFormLayout id="pfl2"...>
                <af:inputText value="#{bindings.EmployeeId.inputValue}"
                              .....
                              disabled="#{viewScope.isNewEmployee eq 'false'}"/>
 
              .....
              </af:panelFormLayout>
              .....
              <af:panelGroupLayout ...>
                .....
                <af:panelFormLayout ...>
                  <af:inputText label="Add/Edit manager using autosuggest"
                                .....
                                id="it4" binding="#{EmployeeBean.managerInputText}"
                                valueChangeListener="#{EmployeeBean.onManagerValueChange}"
                                autoSubmit="true">
                    <af:autoSuggestBehavior suggestedItems="#{EmployeeBean.getSuggestedManagers}"/>
                    .....
                  </af:inputText>
                </af:panelFormLayout>
              </af:panelGroupLayout>
              <af:panelGroupLayout partialTriggers="it4" ...>
                <af:panelFormLayout id="pfl4" rendered='#{viewScope.isNewManager ne ""}'...>
                  <af:inputText value="#{bindings.EmployeeId1.inputValue}"
                                .....
                                disabled="#{viewScope.isNewManager eq 'false'}"/>
                 .....
                </af:panelFormLayout>
              </af:panelGroupLayout>
            </af:panelGroupLayout>
            <f:facet name="buttonBar">
              .....
            </f:facet>
          </af:dialog>
        </af:popup>

onPopupOpen method  implemented in EmployeeBean bean:

?
1
2
3
4
5
6
7
8
public void onPopupOpen(PopupFetchEvent popupFetchEvent) {
    //set the manager name on popup open event
    getManagerInputText().setValue(ADFUtils.getBoundAttributeValue("ManagerName"));
 
    //reset isNewManager to its default value
    Map viewScope = ADFContext.getCurrent().getViewScope();
    viewScope.put("isNewManager", "");
}

Because both Add and Edit use the same popup, the dialog title changes with respect to the operation that is currently executed.
pfl2 panel form contains the employee data. When an existing employee is selected the fields that cannot be edited will be automatically disabled.
it4 input text has the same functionality as the employees inputText but it is used in order to Add/Edit the manager for the currently selected employee. The business is implemented within the EmployeeBean managed bean.
pfl4 panel form contains the info for the manager and is conditionally rendered (notice that the partialTrigger is not defined within the pfl4 component, but instead into the panel group component – which is the parent of pfl4 panel form) with respect to the value of the isNewManager view scope attribute.

Running the sample application

Open ADFFACUAS Fusion Web Application in your JDevelopper IDE, navigate to main.jspx page and run it.

After the application has been successfully deployed the following page will be loaded in your browser:

Start typing something in the input text and a list with suggested employees is displayed – containing the first and last names.

As you type, the list containing the suggested employees is automatically updated:

While navigating through the suggested list notice that the input text is dynamically updated with the selected employee id followed by the first name/names and last name:

If you select an employee from the suggested list and press Enter(or any event that would make the input text to lost the focus) a popup window is displayed containing the selected employee ready for edit:

Otherwise, if your suggested employees list is empty or you do not wish to select an employee from the suggested ones after Enter is pressed the popup window is again displayed but this time a new employee is created and automatically filled out with the entered values:

Now, notice that in both cases: edit existing employee and create new employee there is a field called: Add/Edit manager using autosuggest – this supports autosuggest&autocomplete as well :

It allows the user to assign an existing manager or create a new one for the current employee; but the manager can be edited only while new.

When a value from the suggested list is selected a form in disabled mode, containing the details for the selected manager, is automatically rendered:

Otherwise, a new manager is created and displayed in an editable form (the autocomplete does its job) :

After all fields that are not automatically filled out are provided with valid data and Save button is pressed data is commited; otherwise data is deleted.
The popup is closed after any: Save or Delete occur.
You can check that data has been successfully stored by searching the newly inserted/updated employee immediately after inserting/updating it.
For a better understanding download the application, study it, run it and play with it.
                    </div>                     <p class="tags"><strong>Tags:</strong> <a href="http://www.gebs.ro/tag/autocomplete/" rel="tag">autocomplete</a>, <a href="http://www.gebs.ro/tag/adf-autosuggest/" rel="tag">autosuggest</a></p>                  <div id="comments-wrap">
<h3 id="comments">12 Responses to “ADF Form Autocomplete using Autosuggest behavior – Search, View, Add and/or Edit”</h3><div class="navigation">    <div class="alignleft"></div>    <div class="alignright"></div></div><ol class="commentlist">        <li class="comment even thread-even depth-1" id="comment-972">            <div id="div-comment-972" class="comment-body">            <div class="comment-author vcard">                    <cite class="fn"><a href="http://www.minasdirect.com/" rel="external nofollow" class="url">Data Append</a></cite> <span class="says">says:</span>       </div>    <div class="comment-meta commentmetadata"><a href="http://www.gebs.ro/blog/oracle/oracle-adf-form-autocomplete-using-autosuggest-behavior-search-view-add-edit/#comment-972">        November 10, 2010 at 1:12 PM</a>        </div>    <p>Fabulous</p>    <div class="reply"><a rel="nofollow" class="comment-reply-link" href="http://www.gebs.ro/blog/oracle/oracle-adf-form-autocomplete-using-autosuggest-behavior-search-view-add-edit/?replytocom=972#respond" onclick="return addComment.moveForm( &quot;div-comment-972&quot;, &quot;972&quot;, &quot;respond&quot;, &quot;2754&quot; )" aria-label="Reply to Data Append">Reply</a></div>            </div>    </li><!-- #comment-## -->    <li class="pingback odd alt thread-odd thread-alt depth-1" id="comment-1312">            <div id="div-comment-1312" class="comment-body">            <div class="comment-author vcard">                    <cite class="fn"><a href="http://www.gebs.ro/blog/oracle/adf-autosuggest-performance-tuning-and-testing/" rel="external nofollow" class="url">GEBS | Oracle ADF Autosuggest Performance Tuning and Testing</a></cite> <span class="says">says:</span>       </div>    <div class="comment-meta commentmetadata"><a href="http://www.gebs.ro/blog/oracle/oracle-adf-form-autocomplete-using-autosuggest-behavior-search-view-add-edit/#comment-1312">        December 22, 2010 at 10:53 PM</a>       </div>    <p>[…] <a href="http://www.gebs.ro/blog/oracle/oracle-adf-form-autocomplete-using-autosuggest-behavior-search-view-a" rel="nofollow">http://www.gebs.ro/blog/oracle/oracle-adf-form-autocomplete-using-autosuggest-behavior-search-view-a</a>… […]</p>    <div class="reply"><a rel="nofollow" class="comment-reply-link" href="http://www.gebs.ro/blog/oracle/oracle-adf-form-autocomplete-using-autosuggest-behavior-search-view-add-edit/?replytocom=1312#respond" onclick="return addComment.moveForm( &quot;div-comment-1312&quot;, &quot;1312&quot;, &quot;respond&quot;, &quot;2754&quot; )" aria-label="Reply to GEBS | Oracle ADF Autosuggest Performance Tuning and Testing">Reply</a></div>            </div>    </li><!-- #comment-## -->    <li class="comment even thread-even depth-1 parent" id="comment-1552">            <div id="div-comment-1552" class="comment-body">            <div class="comment-author vcard">                    <cite class="fn">Amit Seth</cite> <span class="says">says:</span>       </div>    <div class="comment-meta commentmetadata"><a href="http://www.gebs.ro/blog/oracle/oracle-adf-form-autocomplete-using-autosuggest-behavior-search-view-add-edit/#comment-1552">        February 10, 2011 at 7:39 PM</a>        </div>    <p>Hey, You’ve done a great job!!</p>

But this doesn’t work when you choose an employee with a mouse instead of keyboard. Do you know how you can make this work?

    <div class="reply"><a rel="nofollow" class="comment-reply-link" href="http://www.gebs.ro/blog/oracle/oracle-adf-form-autocomplete-using-autosuggest-behavior-search-view-add-edit/?replytocom=1552#respond" onclick="return addComment.moveForm( &quot;div-comment-1552&quot;, &quot;1552&quot;, &quot;respond&quot;, &quot;2754&quot; )" aria-label="Reply to Amit Seth">Reply</a></div>            </div>    <ul class="children">    <li class="comment byuser comment-author-bogdanelloo bypostauthor odd alt depth-2" id="comment-1555">            <div id="div-comment-1555" class="comment-body">            <div class="comment-author vcard">                    <cite class="fn">Bogdan Petridean</cite> <span class="says">says:</span>        </div>    <div class="comment-meta commentmetadata"><a href="http://www.gebs.ro/blog/oracle/oracle-adf-form-autocomplete-using-autosuggest-behavior-search-view-add-edit/#comment-1555">        February 11, 2011 at 11:06 AM</a>       </div>    <p>Hi Amit,</p>

Thank you for your feedback.

Now, regarding your problem the sample application works as below:
1. Type some text in the “Add/Edit employee using autosuggest:” af:inputText.
2. A list of employees is displayed.
3. Use the mouse (or keyboard) to select one of the suggested items => the Edit popup will be displayed.
So, the selection should work regarding you use the mouse or keyboard.
If this is not the case please elaborate some more.

Regards,
Bogdan.

            </div>    </li><!-- #comment-## -->    <li class="comment even depth-2" id="comment-3634">            <div id="div-comment-3634" class="comment-body">            <div class="comment-author vcard">                    <cite class="fn">Vipir</cite> <span class="says">says:</span>       </div>    <div class="comment-meta commentmetadata"><a href="http://www.gebs.ro/blog/oracle/oracle-adf-form-autocomplete-using-autosuggest-behavior-search-view-add-edit/#comment-3634">        July 10, 2014 at 4:59 PM</a>        </div>    <p>It wont make difference for you but for those who runs into the same issue it’s known bug:<br>

Autosuggestbehavior with Mouse doesn’t work correctly when a Custom Converter is Used (Doc ID 1448944.1)

            </div>    </li><!-- #comment-## -->






  • Amit Seth says:
  •     <div class="comment-meta commentmetadata"><a href="http://www.gebs.ro/blog/oracle/oracle-adf-form-autocomplete-using-autosuggest-behavior-search-view-add-edit/#comment-1591">        February 15, 2011 at 8:56 PM</a>        </div>    <p>Hey Bogdan,</p>

    Thank you for your reply.

    Here’s the problem that I’m facing when you run the application.
    When you type in ‘a’ in the input box… a list of employees name will appear that contains ‘a’. Which is expected…
    When you select an employee using the mouse keyboard and click enter, it will display “Edit Existing Employee” dialog with employee’s information. Which is also expected.

    However, when you select the same employee with a mouse, it displays “Add New Employee” dialog box and every fields are clear except for First Name (it prefills it with ‘a’).

    Let me know if you want me to send you a screen shot or something. Thanks!!

        <div class="reply"><a rel="nofollow" class="comment-reply-link" href="http://www.gebs.ro/blog/oracle/oracle-adf-form-autocomplete-using-autosuggest-behavior-search-view-add-edit/?replytocom=1591#respond" onclick="return addComment.moveForm( &quot;div-comment-1591&quot;, &quot;1591&quot;, &quot;respond&quot;, &quot;2754&quot; )" aria-label="Reply to Amit Seth">Reply</a></div>            </div>    <ul class="children">    <li class="comment byuser comment-author-bogdanelloo bypostauthor even depth-2" id="comment-1598">            <div id="div-comment-1598" class="comment-body">            <div class="comment-author vcard">                    <cite class="fn">Bogdan Petridean</cite> <span class="says">says:</span>        </div>    <div class="comment-meta commentmetadata"><a href="http://www.gebs.ro/blog/oracle/oracle-adf-form-autocomplete-using-autosuggest-behavior-search-view-add-edit/#comment-1598">        February 17, 2011 at 1:44 AM</a>        </div>    <p>Hi Amit,</p>

    I have taken the following steps:
    1. Downloaded the sample application.
    2. Run main.jspx
    3. Type ‘a’ into the “Add/Edit employee…” inputText
    4. Placed over one of the employees from the suggested list (is highlighted when the mouse moves over it) with the mouse and clicked on it.
    5. The Edit Existing Employee Popup is displayed.
    => Expected behavior.

    Now, the above test is a simple one and if you say that in your case is buggy then I shall dig some more (over the weekend) and come back to you.

    P.S.:
    “However, when you select the same employee with a mouse, it displays “Add New Employee” dialog box and every fields are clear except for First Name (it prefills it with ‘a’).”

    This means that the selection did not occur and ‘a’ is considered to be a new employee, in which case a new row is inserted into the EmployeesVOIterator and the FirstName attribute is set to ‘a’.
    If you would have written ‘a b’ into the inputText than the FirstName att would have been set to ‘a’ and the LastName to ‘b’.

    Thank you,
    Bogdan.

                </div>    </li><!-- #comment-## -->






  • Andrey says:
  •     <div class="comment-meta commentmetadata"><a href="http://www.gebs.ro/blog/oracle/oracle-adf-form-autocomplete-using-autosuggest-behavior-search-view-add-edit/#comment-2800">        November 1, 2011 at 10:42 PM</a>        </div>    <p>Hi,<br>

    I am using jdev 11.1.2.0.0.
    In our project in some cases we have to create RichInputText components programmatically.
    Do you know a way to add AutoSuggestBehavior programmatically?

    I’ll appreciate any pointer…

    Thanks!

        <div class="reply"><a rel="nofollow" class="comment-reply-link" href="http://www.gebs.ro/blog/oracle/oracle-adf-form-autocomplete-using-autosuggest-behavior-search-view-add-edit/?replytocom=2800#respond" onclick="return addComment.moveForm( &quot;div-comment-2800&quot;, &quot;2800&quot;, &quot;respond&quot;, &quot;2754&quot; )" aria-label="Reply to Andrey">Reply</a></div>            </div>    </li><!-- #comment-## -->    <li class="comment even thread-odd thread-alt depth-1" id="comment-3473">            <div id="div-comment-3473" class="comment-body">            <div class="comment-author vcard">                    <cite class="fn"><a href="http://jocuribatai2013.blogspot.ro/" rel="external nofollow" class="url">batai</a></cite> <span class="says">says:</span>     </div>    <div class="comment-meta commentmetadata"><a href="http://www.gebs.ro/blog/oracle/oracle-adf-form-autocomplete-using-autosuggest-behavior-search-view-add-edit/#comment-3473">        November 19, 2013 at 1:42 PM</a>        </div>    <p>Teenagers ttend to want faast cameras for capturing those quick snapshots,<br>

    and gravitate towards small cameras with unique features like
    Polaroid’s “instant” digital camera with a built-in printer.
    Position yourself so that your kids are between you and the sun.
    You can even configure the application to send the alert to up to 10
    people simultaneously.

        <div class="reply"><a rel="nofollow" class="comment-reply-link" href="http://www.gebs.ro/blog/oracle/oracle-adf-form-autocomplete-using-autosuggest-behavior-search-view-add-edit/?replytocom=3473#respond" onclick="return addComment.moveForm( &quot;div-comment-3473&quot;, &quot;3473&quot;, &quot;respond&quot;, &quot;2754&quot; )" aria-label="Reply to batai">Reply</a></div>            </div>    </li><!-- #comment-## -->    <li class="comment odd alt thread-even depth-1" id="comment-3607">            <div id="div-comment-3607" class="comment-body">            <div class="comment-author vcard">                    <cite class="fn"><a href="http://test.com" rel="external nofollow" class="url">how to use whatsapp on pc</a></cite> <span class="says">says:</span>     </div>    <div class="comment-meta commentmetadata"><a href="http://www.gebs.ro/blog/oracle/oracle-adf-form-autocomplete-using-autosuggest-behavior-search-view-add-edit/#comment-3607">        May 13, 2014 at 2:08 PM</a>     </div>    <p>I am actually pleased to glance at this weblog posts which carries lots of<br>

    valuable facts, thanks for providing these kinds
    of statistics.

        <div class="reply"><a rel="nofollow" class="comment-reply-link" href="http://www.gebs.ro/blog/oracle/oracle-adf-form-autocomplete-using-autosuggest-behavior-search-view-add-edit/?replytocom=3607#respond" onclick="return addComment.moveForm( &quot;div-comment-3607&quot;, &quot;3607&quot;, &quot;respond&quot;, &quot;2754&quot; )" aria-label="Reply to how to use whatsapp on pc">Reply</a></div>            </div>    </li><!-- #comment-## -->    <li class="comment even thread-odd thread-alt depth-1" id="comment-3625">            <div id="div-comment-3625" class="comment-body">            <div class="comment-author vcard">                    <cite class="fn"><a href="http://abhinandanpanda.com" rel="external nofollow" class="url">Abhinandan Panda</a></cite> <span class="says">says:</span>       </div>    <div class="comment-meta commentmetadata"><a href="http://www.gebs.ro/blog/oracle/oracle-adf-form-autocomplete-using-autosuggest-behavior-search-view-add-edit/#comment-3625">        July 3, 2014 at 7:23 PM</a>     </div>    <p>I integrated the jquery’s ui autosuggest component with ADF faces – See more at: <a href="http://www.abhinandanpanda.com/2014/06/adf-jquery-auto-suggest-implementation.html#sthash.I8nh1cAK.dpuf" rel="nofollow">http://www.abhinandanpanda.com/2014/06/adf-jquery-auto-suggest-implementation.html#sthash.I8nh1cAK.dpuf</a></p>    <div class="reply"><a rel="nofollow" class="comment-reply-link" href="http://www.gebs.ro/blog/oracle/oracle-adf-form-autocomplete-using-autosuggest-behavior-search-view-add-edit/?replytocom=3625#respond" onclick="return addComment.moveForm( &quot;div-comment-3625&quot;, &quot;3625&quot;, &quot;respond&quot;, &quot;2754&quot; )" aria-label="Reply to Abhinandan Panda">Reply</a></div>            </div>    </li><!-- #comment-## -->    <li class="comment odd alt thread-even depth-1" id="comment-3646">            <div id="div-comment-3646" class="comment-body">            <div class="comment-author vcard">                    <cite class="fn">andrew</cite> <span class="says">says:</span>      </div>    <div class="comment-meta commentmetadata"><a href="http://www.gebs.ro/blog/oracle/oracle-adf-form-autocomplete-using-autosuggest-behavior-search-view-add-edit/#comment-3646">        August 1, 2014 at 12:19 AM</a>      </div>    <p>Hi thanks for a good post. Did you implemented Auto Suggest in a input text box in a table column. Im facing a small problem. The issue is when autosuggest list pops up if you use your keyboard up/down arrow. it goes and select the next rows instead of values in the popup list. If you can, can you suggest a solution or your inputs thanks</p>    <div class="reply"><a rel="nofollow" class="comment-reply-link" href="http://www.gebs.ro/blog/oracle/oracle-adf-form-autocomplete-using-autosuggest-behavior-search-view-add-edit/?replytocom=3646#respond" onclick="return addComment.moveForm( &quot;div-comment-3646&quot;, &quot;3646&quot;, &quot;respond&quot;, &quot;2754&quot; )" aria-label="Reply to andrew">Reply</a></div>            </div>    </li><!-- #comment-## --></ol><div class="navigation">    <div class="alignleft"></div>    <div class="alignright"></div></div>

    转自原文 —–http://www.gebs.ro/blog/oracle/oracle-adf-form-autocomplete-using-autosuggest-behavior-search-view-add-edit/

    原创粉丝点击