Page 1 of 1

Object selecteded event in autoComplete?

Posted: 21 Feb 2011, 19:53
by jaizen
Hi

I am trying to perform some client side action when an object is selected from the autoComplete drop down selection. I am struggling to find the right client side event for this. onselect, onchange, oncomplete events do not know whether an object was selected or not especially when there are no results returned. Richfaces has an event called 'onobjectchange' on their suggestionBox component which did the job. Is there something similar that I can use in p:autoComplete?

Also, is there a way to show a default label such as 'No results found' when there are, well, no results returned? I feel that it will confuse users when they dont see any results esp. when used in conjuction with forceSelection=true.

Please help. I need find a solution for this as soon as possible.

Re: Object selecteded event in autoComplete?

Posted: 21 Feb 2011, 20:09
by poppy
Hi, i think you need the selectListener and onSelectUpdated options
Here is an example:

Code: Select all

<p:autoComplete id="productMessage" value="#{goBean.selectItem}" 
	 completeMethod="#{autoCompleteBean.valueChanged}"
	 var="selectItem" 
	 itemLabel="#{selectItem.label}" 
	 itemValue="#{selectItem}" 	
	 minQueryLength="4"
	 maxResults="5"
	 forceSelection="true"
	 converter="productConverter"
	 selectListener="#{goBean.actionButton}"
	 onSelectUpdate="body myProductDetail"
	 style="width:400px;"
	 />
Good luck!!

Re: Object selecteded event in autoComplete?

Posted: 24 Feb 2011, 03:28
by jaizen
poppy,
thanks for replying. But I think the option you have mentioned is for ajax updates/rendering. I still wont know whether or not I selected an item from the list. I may have to try callback parameters and see if that will help me.

Re: Object selecteded event in autoComplete?

Posted: 28 Feb 2011, 20:57
by little_b
i want to vote about this question. I'm looking for a solution too

Re: Object selecteded event in autoComplete?

Posted: 26 Apr 2011, 08:49
by Urbiwanus
Any solutions for this problem yet ?