Fórumok

jquery autocomplete usage

anantharam as, módosítva 15 év-val korábban

jquery autocomplete usage

New Member Bejegyzések: 2 Csatlakozás dátuma: 2008.05.19. Legújabb bejegyzések
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, módosítva 15 év-val korábban

RE: jquery autocomplete usage

New Member Bejegyzések: 2 Csatlakozás dátuma: 2008.05.19. Legújabb bejegyzések
I got the solution now.

instead of $ we need to use jQuery for it to work in Liferay.
Robert Bohonek, módosítva 15 év-val korábban

RE: jquery autocomplete usage

New Member Bejegyzés: 1 Csatlakozás dátuma: 2009.02.26. Legújabb bejegyzések
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, módosítva 14 év-val korábban

RE: jquery autocomplete usage

Junior Member Bejegyzések: 27 Csatlakozás dátuma: 2008.07.14. Legújabb bejegyzések
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, módosítva 14 év-val korábban

RE: jquery autocomplete usage

New Member Bejegyzések: 4 Csatlakozás dátuma: 2009.09.23. Legújabb bejegyzések
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, módosítva 14 év-val korábban

RE: jquery autocomplete usage

New Member Bejegyzések: 2 Csatlakozás dátuma: 2009.10.12. Legújabb bejegyzések
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, módosítva 13 év-val korábban

RE: jquery autocomplete usage

New Member Bejegyzések: 13 Csatlakozás dátuma: 2010.02.15. Legújabb bejegyzések
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, módosítva 9 év-val korábban

RE: jquery autocomplete usage

New Member Bejegyzések: 18 Csatlakozás dátuma: 2014.08.01. Legújabb bejegyzések
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???