Autocomplete suggestions list misbehaviours

UI Components for JSF
Post Reply
porthos
Posts: 122
Joined: 09 May 2011, 03:17

27 Nov 2011, 20:14

Some observations about odd behaviours of the autocomplete suggestions list in 3.0 M4:

1. When the initial suggestions list for an autocomplete field is too long to display below the control, it correctly gets displayed above. But when it subsequently changes length as you type, the top of the suggest list stays in the same place. This creates 2 possible problems:

a) If the list shortens, its bottom becomes detached from the text field.

Image

b) If the list becomes longer, it may start overlapping the text field where you're typing.

Image

2. On a related note, when a suggestions list initially is short enough to display below, and then becomes longer as you type, it does not flip to go above the text field. Instead it just lengthens below, and increases page size - causing a scrollbar to appear.

Image

3. If the mouse pointer is located over the place where the suggestions list will appear, then when you start typing and the suggestions list appears, both the top suggestion, and the one under the mouse pointer become selected. If you subsequently scroll through the suggestions with cursor keys, both "selected" items respond to the cursors, so they both move up and down:

Image

In fact, by playing around with the cursor keys and the mouse for a bit, you can get any number of items to become "selected".

4. In some cases selecting a suggested item by mouse click does not work. The suggestion list disappears as though the selection succeeded, but the text field is not updated with the selected value - it just contains whatever was typed. Admittedly, this only happens for this fairly complex suggestion list definition. I haven't been able to get it to fail on simpler layouts. Code for this one looks like this:

Code: Select all

      <p:autoComplete id="address" value="#{cc.attrs.address.search}"
                      size="65" styleClass="#{cc.attrs.address.selectedAddressInternal ? 'italic-input' : ''}"
                      var="addressSuggestion"
                      converter="#{addressSearchByIdConverter}"
                      completeMethod="#{cc.attrs.address.getSuggestedAddresses}"
                      itemLabel="#{addressSuggestion.displayName}"
                      itemValue="#{addressSuggestion}" queryDelay="350" maxResults="21">
        <p:column>
          <h:panelGrid columns="3" cellpadding="0" cellspacing="0">
            <h:outputText rendered="#{!empty addressSuggestion.addressType.iconType}"
                          styleClass="#{hb:concat('tpt-icon16 tpt-icon16-', addressSuggestion.addressType.iconType, '')}"/>
            <p:outputPanel rendered="#{!empty addressSuggestion.aliasId}">
              <h:outputText value="#{addressSuggestion.addressAlias}"
                            style="font-weight: bold;"/>
              <h:outputText value=" (#{hb:abbreviate(addressSuggestion.displayName, 40, 50, '...')})"
                            styleClass="#{addressSuggestion.externalAddress ? '' : 'italic'}"/>
            </p:outputPanel>
            <h:outputText rendered="#{empty addressSuggestion.aliasId}" escape="false"
                          value="#{hb:htmlBoldMatches(addressSuggestion.displayName,cc.attrs.address.lastSearchAddress)}"
                          styleClass="#{addressSuggestion.externalAddress ? '' : 'italic'}"/>
          </h:panelGrid>
        </p:column>
      </p:autoComplete>
-------
PrimeFaces 3.4, Glassfish 3.1.2, Mojarra 2.1.6

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

28 Nov 2011, 03:19

First of all, I'd like to congratulate you for successfully implementing AutoComplete. I tried, and AutoComplete in my JSF/PrimeFaces web app is NOT working as designed, maybe because of the PostRedirectGetListener (phase listener) that I have in place that is monitoring RENDER RESPONSE phase. When I type one character in Autocomplete field, he seems to make an AJAX request to server, and suggestions are NOT displayed at all, no box or dropdown, and then the character that I typed is erased from the field.

I would love to use Autocomplete, but I'm having to implement workarounds via dataTable picklist, which may be better any way for my use case.

Anyway, thanks for sharing the misbehaviors of autocomplete. You might want to open issue tickets; PrimeFaces team/lead may actually get them resolved. :)
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

porthos
Posts: 122
Joined: 09 May 2011, 03:17

29 Nov 2011, 02:18

Thanks. Guess I was just lucky to have no fatally interfering config elements. Worked for me out of the box. Apart from some minor issues with Themeroller css.

I opened the following bug reports:

1. a. & b.: http://code.google.com/p/primefaces/iss ... il?id=2919

2. http://code.google.com/p/primefaces/iss ... il?id=2920

3. http://code.google.com/p/primefaces/iss ... il?id=2921

I'm unable so far to come up with a simple reproducible test case for no 4. Suspect my ajax behaviours on this control may be causing the intermittent failure to select.
-------
PrimeFaces 3.4, Glassfish 3.1.2, Mojarra 2.1.6

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

29 Nov 2011, 20:41

Good job! How did you embed those images in your first post (above). I see the Img button which embed img tags here, but I don't know how to do that. do you embed the filepath of your image inside of the img tags?
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

porthos
Posts: 122
Joined: 09 May 2011, 03:17

29 Nov 2011, 22:24

Upload to imageshack.us. It then provides a link in the sidebar you can paste to embed the image.
-------
PrimeFaces 3.4, Glassfish 3.1.2, Mojarra 2.1.6

porthos
Posts: 122
Joined: 09 May 2011, 03:17

05 Dec 2011, 13:11

I've managed to track down the reasons for the bad behaviour mention in item 4 on the original post. It was due to using a combination of itemSelect and value change ajax behaviours on the component.

More details in another forum post here: viewtopic.php?f=3&t=16677

And I've opened a bug for the issue here: http://code.google.com/p/primefaces/iss ... il?id=2975
-------
PrimeFaces 3.4, Glassfish 3.1.2, Mojarra 2.1.6

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

05 Dec 2011, 19:04

Since issue 2975 has WontFix status, can you implement an Ajax phaseListener to solve this issue? If so, please share your code.
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 32 guests