Foros de discusión

jquery autocomplete usage

anantharam as, modificado hace 15 años.

jquery autocomplete usage

New Member Mensajes: 2 Fecha de incorporación: 19/05/08 Mensajes recientes
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, modificado hace 15 años.

RE: jquery autocomplete usage

New Member Mensajes: 2 Fecha de incorporación: 19/05/08 Mensajes recientes
I got the solution now.

instead of $ we need to use jQuery for it to work in Liferay.
Robert Bohonek, modificado hace 15 años.

RE: jquery autocomplete usage

New Member Mensaje: 1 Fecha de incorporación: 26/02/09 Mensajes recientes
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, modificado hace 14 años.

RE: jquery autocomplete usage

Junior Member Mensajes: 27 Fecha de incorporación: 14/07/08 Mensajes recientes
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, modificado hace 14 años.

RE: jquery autocomplete usage

New Member Mensajes: 4 Fecha de incorporación: 23/09/09 Mensajes recientes
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, modificado hace 14 años.

RE: jquery autocomplete usage

New Member Mensajes: 2 Fecha de incorporación: 12/10/09 Mensajes recientes
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, modificado hace 13 años.

RE: jquery autocomplete usage

New Member Mensajes: 13 Fecha de incorporación: 15/02/10 Mensajes recientes
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, modificado hace 9 años.

RE: jquery autocomplete usage

New Member Mensajes: 18 Fecha de incorporación: 1/08/14 Mensajes recientes
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???