Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Gwowen Fu
JavaScript to access portlets on screen
September 20, 2012 2:33 PM
Answer

Gwowen Fu

Rank: Expert

Posts: 307

Join Date: December 27, 2010

Recent Posts

Hi,

How could I access portlets on screen using Liferay Javascript API?

I was able to add a portlet to page using the following script but not able to access it through Liferay object.

function openAssetPublisher(currentElement, articleId) {

var plid = themeDisplay.getPlid();
var portletId = '101';
var onComplete = function(){ alert("hi"); location.reload(true); };
var beforePortletLoaded = null;
var portletOptions = {
beforePortletLoaded: beforePortletLoaded,
onComplete: onComplete,
plid: plid,
portletId: portletId,
};

Liferay.Portlet.add(portletOptions);
}

Thanks!
Gwowen
Gwowen Fu
RE: JavaScript to access portlets on screen
September 21, 2012 7:19 AM
Answer

Gwowen Fu

Rank: Expert

Posts: 307

Join Date: December 27, 2010

Recent Posts

Fount it. It is Liferay.Layout.getPortlets().