Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Lior Hadaya
Liferay.Service.Portal.getLayoutName in Javascript
November 14, 2012 1:14 AM
Answer

Lior Hadaya

Rank: Regular Member

Posts: 138

Join Date: January 24, 2012

Recent Posts

Hello,

I'm using Liferay EE 6.1.20 and I'm trying to get the name of the current layout using Javascript.
I tried to use the getLayoutName method but the callback receives null as the result:
1
2var params = {};
3var layout;
4Liferay.Service.Portal.Layout.getLayoutName(params, function(p) {
5    layout = p;
6});

I tried to debug the service call and didn't see anything unusual, it seems that Liferay does send a request and gets a response back, just without the name of the layout..

Can you please tell me what I'm doing wrong?

Thanks,

Lior
Juan Gonzalez
RE: Liferay.Service.Portal.getLayoutName in Javascript
November 14, 2012 2:43 AM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1984

Join Date: October 28, 2008

Recent Posts

Did you check what are the needed params for that method? Probably you have to provide a param (for example, current plid).
Lior Hadaya
RE: Liferay.Service.Portal.getLayoutName in Javascript
November 14, 2012 3:09 AM
Answer

Lior Hadaya

Rank: Regular Member

Posts: 138

Join Date: January 24, 2012

Recent Posts

I haven't been able to find official documentation for the method (or any of Liferay's Javascript API for that matter).
According to the browser console, the method expects to get two parameters - params object and a callback. I have no idea if I need to set any data inside the params object.