Documentation
Liferay provides a rich store of resources and knowledge to help our community better use and work with our technology.
JavaScript
Liferay now includes its own JavaScript library called Alloy, which is an extension to Yahoo's YUI3 framework. Developers can take advantage of the full power of either of these frameworks in their themes. Inside of the main.js file, you will find definitions for three JavaScript callbacks:
AUI().ready(
function() {
}
);
Liferay.Portlet.ready(
/*
This function gets loaded after each and every portlet on the page.
portletId: the current portlet's id
node: the Alloy Node object of the current portlet
*/
function(portletId, node) {
}
);
Liferay.on(
'allPortletsReady',
/*
This function gets loaded when everything, including the portlets, is on
the page.
*/
function() {
}
);
AUI().ready(fn);
This callback is executed as soon as the HTML in the page has finished loading (minus any portlets loaded via ajax).
Liferay.Portlet.ready(fn);
Executed after each portlet on the page has loaded. The callback receives two parameters: portletId and node. portletId is the id of the portlet that was just loaded. node is the Alloy Node object of the same portlet.
Liferay.on('allPortletsReady', fn);
Executed after everything—including AJAX portlets—has finished loading.