Foren

jquery autocomplete usage

anantharam as, geändert vor 15 Jahren.

jquery autocomplete usage

New Member Beiträge: 2 Beitrittsdatum: 19.05.08 Neueste Beiträge
we are trying to use autocomplete jquery ui component which is part of Liferay.

Following sample works fine as a simple web app
http://docs.jquery.com/Plugins/Autocomplete

where as if we try to use it as part of Liferay portlet its failing.
saying "autocomplete is not function.


Can anyone point us to right usage of autocomplete that work's with jquery in Liferay.
anantharam as, geändert vor 15 Jahren.

RE: jquery autocomplete usage

New Member Beiträge: 2 Beitrittsdatum: 19.05.08 Neueste Beiträge
I got the solution now.

instead of $ we need to use jQuery for it to work in Liferay.
Robert Bohonek, geändert vor 15 Jahren.

RE: jquery autocomplete usage

New Member Beitrag: 1 Beitrittsdatum: 26.02.09 Neueste Beiträge
I got solution for liferay-portal-5.2.

First you must include javascript ui.autocomplete.js (<portal-root>\jboss-tomcat-4.2.3\server\default\deploy\ROOT.war\html\js) into liferay-portlet.xml (see Liferay wiki) as <header-portlet-javascript>.

Second you try this code in jsp :


<script type="text/javascript">
jQuery(document).ready(function(){
	var mydata =  [ "aaaa", "bbbb" , "cccc", "aabb" ];
	jQuery('#acbox').autocomplete({data:mydata});
	}
	);
</script>

Autocomplete : <input id="acbox" type="text">
thumbnail
Ryan McKeel, geändert vor 14 Jahren.

RE: jquery autocomplete usage

Junior Member Beiträge: 27 Beitrittsdatum: 14.07.08 Neueste Beiträge
With Liferay v5.2.2, I find that this works. I put it in a web content (previously 'journal entry') display:

<script type="text/javascript" src="/html/js/jquery/ui.autocomplete.js"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
	var mydata = "Core Selectors Attributes Traversing Manipulation CSS Events Effects Ajax Utilities".split(" ");
	jQuery('#acbox').autocomplete({data:mydata});
});
</script>
<input id="acbox" type="text">


Doing mydata using split(" ") makes it easier to type in the data.
preethi babu, geändert vor 14 Jahren.

RE: jquery autocomplete usage

New Member Beiträge: 4 Beitrittsdatum: 23.09.09 Neueste Beiträge
hi all,

how can we get multiple values using delimeters in the textBox.

this how i tried but its not working. only the first one come.After a comma others are not populated

<script type="text/javascript">
jQuery(document).ready(function(){
var mydata = "Core Selectors Attributes Traversing Manipulation CSS Events Effects Ajax Utilities".split(" ");
jQuery('#relIdeas').autocomplete({data:mydata,delimiter: /(,|;)\s*/}); }
);
</script>
John Bush, geändert vor 14 Jahren.

RE: jquery autocomplete usage

New Member Beiträge: 2 Beitrittsdatum: 12.10.09 Neueste Beiträge
Why the need to specify {data:mydata} for this to work? The code base I am converting from does not require the 'data:' prefix and I can't find a reason even on the authors url. I am trying to understand it because I assume now there will be a few more gotchas having to migrate backwards from 1.3.2 to 1.2.6 that is in EE 5.2 SP3!
Latara Smith, geändert vor 13 Jahren.

RE: jquery autocomplete usage

New Member Beiträge: 13 Beitrittsdatum: 15.02.10 Neueste Beiträge
Hi guys,

thanks a lot for your guidelines. Now I am trying to substitue mydata with remote content processed by my Portlet's processAction method.
Any tips on how to do that?

I know I have to add something along the lines of:


 var url = '<portlet:actionurl windowState="<%=LiferayWindowState.EXCLUSIVE.toString()%>" />'

jQuery('#acbox').autocomplete({

    	 source: function(request, response){
    	     jQuery.ajax(url: url, {keyword: keyword}, function(data){
					response(data);});
        	 }
   		}
     


Also I am not quite sure how the processAction method should return the autocomplete suggestions...

Any help would be greatly appreciated!

cheers,

L.
Javier Vera, geändert vor 9 Jahren.

RE: jquery autocomplete usage

New Member Beiträge: 18 Beitrittsdatum: 01.08.14 Neueste Beiträge
yo guys Liferay is now in 6.2 version and a guy who i work with had disabled parameter names with requiered namespace... and this worked.
Anyone know how to fix this?? or at least let Liferay pass this library???