11 November, 2011

jQuery in liferay 6

Hi Everyone,
you will be aware that jquery plugin has been removed from LR 6 and alloyui has been integrated for gr8 UI.
So Still if you want to integrate jquery with liferay 6 then follow below steps :



1. Add jQuery into your portlet - put into portlet definition in liferay-portlet.xml given as below :

<header-portlet-javascript>https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js</header-portlet-javascript>
  <header-portlet-javascript>https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/jquery-ui.min.js</header-portlet-javascript>
2. Sample code which will use jquery:
<input type="text" autocomplete="off" name="<portlet:namespace/>organizationName" id="<portlet:namespace/>organizationName"/>

<aui:script>
var company = ['CIGNEX', 'Google Inc.', 'Microsoft Inc.'];
$( '#<portlet:namespace/>organizationName' ).autocomplete({
 source: orgs
});
</aui:script>
And if you need for any style changes, then you may need to create associated CSS.

Popular Posts

Featured Post

Liferay 7.3 compatibility matrix

Compatibility Matrix Liferay's general policy is to test Liferay Portal CE against newer major releases of operating systems, open s...