掲示板

Auto Complete with AJAX

thumbnail
8年前 に Jignesh Vachhani によって更新されました。

Auto Complete with AJAX

Liferay Master 投稿: 803 参加年月日: 08/03/10 最新の投稿
Hi Everyone,

After so long time visiting Liferay forum.
Actually i need some code where we are using AUI suto complete plugin along with AJAX call.
Actually my requirement is,

When user type in any characters in text field at the same time it should make ajax call and whatever have been get the result from that it should quickly visible in auto complete dropdown.

I am using below code but seems its not working as expected :


AUI().use('autocomplete-list','aui-base','aui-io-request','autocomplete-filters','autocomplete-highlighters',function (A) {
var testData;
new A.AutoCompleteList({
allowBrowserAutocomplete: 'true',
activateFirstItem: 'true',
inputNode: '#<portlet:namespace />myInputNode',
resultTextLocator:'email',
render: 'true',
resultHighlighter: 'phraseMatch',
resultFilters:['phraseMatch'],
source:function(){
			var inputValue=A.one("#<portlet:namespace />myInputNode").get('value');
			var myAjaxRequest=A.io.request('&lt;%=getUsers.toString()%&gt;',{
	  						    dataType: 'json',
	  							method:'POST',
	  							data:{
	  							<portlet:namespace />userEmail:inputValue,
	  							},
	  							autoLoad:false,
	  							sync:false,
	  						    on: {
	   			 				 success:function(){
	   			 					var data=this.get('responseData');
	   			 					testData=data;
	   			 				}}
							});
							myAjaxRequest.start();
							return testData;},
							});
});



your inputs really appreciated.
thumbnail
8年前 に Liferay Dev によって更新されました。

RE: Auto Complete with AJAX

Junior Member 投稿: 81 参加年月日: 15/05/17 最新の投稿
Just follow this URL LIferaySavvy AutoComplete AJAX
thumbnail
8年前 に Jignesh Vachhani によって更新されました。

RE: Auto Complete with AJAX

Liferay Master 投稿: 803 参加年月日: 08/03/10 最新の投稿
Yes i am using the same way which is mentioned here. Something is wrong there which leads to give result lagging behind one call.
thumbnail
8年前 に Jignesh Vachhani によって更新されました。

RE: Auto Complete with AJAX (回答)

Liferay Master 投稿: 803 参加年月日: 08/03/10 最新の投稿
Friends,

Here is the detail how you can use auto complete script : http://www.liferaysolution.com/2015/07/autocomplete-ajax-alloyui.html