AutoComplete custom content without columns

UI Components for JSF
Post Reply
bjoern
Posts: 9
Joined: 28 Jul 2014, 15:52

28 Jul 2014, 17:21

Hello,

I'm new to this forum.

I'm looking for a solution for custom content in an autocomplete selection.

The user searches for something like: "123"
and gets suggestions with some additional information in brackets:
1234 (some infos)
1238 (some other infos)
1239 (some additional infos)

If the user chooses "1234 (some infos)" then in the input field is only written "1234". Because "1234" ist the key.

I found a solution by using custom content with one column.
But using custom content with columns changes the look of the suggestions dropdown.
Is there a better solution?
PF 5.3, JSF 2.1

bsanders1979
Posts: 69
Joined: 02 Jun 2013, 18:37

29 Jul 2014, 06:05

Are you using the itemLabel attribute?
PF 5.0
PF Ext 0.7.1
OmniFaces 1.7
Tomcat 7.0.37
JSF 2.1.24

bjoern
Posts: 9
Joined: 28 Jul 2014, 15:52

29 Jul 2014, 09:45

thanks for your input.

Yes, I use itemLabel. But when I use itemLabel without a custom content column is it in the end the same in the input-box and in the suggestions-list.

At the moment I use one custom content column:

Code: Select all

<p:autoComplete ... var="item" itemLabel="#{item.searchText}" itemValue="#{item}"  converter="..." emptyMessage="...">
    <p:column>
        <h:outputText value="#{item.searchText}" /> (<h:outputText value="#{item.additionalText}" />)
    </p:column>
</p:autoComplete>
But I don't want any table.
What I need is close to the itemtip functionality. But I don't want an extra itemtip pop-up. I want the information in the suggestions-list.
PF 5.3, JSF 2.1

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

29 Jul 2014, 10:24

bjoern wrote:But using custom content with columns changes the look of the suggestions dropdown.
Is there a better solution?
Restyling the suggestions dropdown?

bjoern
Posts: 9
Joined: 28 Jul 2014, 15:52

29 Jul 2014, 16:37

Yes, restyling the suggestions dropdown is a logic step.

But I decided to override the AutoCompleteRenderer. The advantage of overriding the renderer is, that the autocomplete character highlighting still works.

Would be nice if PF would add a suggestion facet... for layouting the suggestions.

So this thread is solved.
PF 5.3, JSF 2.1

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

29 Jul 2014, 17:40

why would hightlighting not work anymore when styling the dropdown? Care to elaborate?

bsanders1979
Posts: 69
Joined: 02 Jun 2013, 18:37

29 Jul 2014, 22:25

I've run into the same issue. I dicovered that &'s would be rendered as "&". So, after reviewing the source and finding the cause of the issue (something about CDATA in the ResponseWriter, IIRC), I added <p:column /> as a child which killed the bolding.
PF 5.0
PF Ext 0.7.1
OmniFaces 1.7
Tomcat 7.0.37
JSF 2.1.24

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 40 guests