Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Leonard E. Sitongia
How do I use Liferay JavaScript API?
January 9, 2009 4:02 PM
Answer

Leonard E. Sitongia

Rank: Regular Member

Posts: 136

Join Date: September 12, 2006

Recent Posts

I've been trying out some examples, and I can't get anything from the Liferay JavaScript API to work. For example, I'm trying to find the value of the Brower:

1
2<script language="javascript">
3    browser = Liferay.Browser.version();
4    document.write("browser ");
5     document.write(browser);
6</script>


Nothing is printed out, not even the literal "browser".

Is there a file that should be included? I've seen some references to service_packed.js in another thread, but I've tried that.

Thanks for your help,
==Leonard
sri p
RE: How do I use Liferay JavaScript API?
July 4, 2011 2:15 PM
Answer

sri p

Rank: Junior Member

Posts: 79

Join Date: January 22, 2011

Recent Posts

Hi,

I too have requirement where I would like to use liferay javascript functions.
1var renderURL = Liferay.PortletURL.createRenderURL();
2alert( "renderURL: " + renderURL.toString() );


I tried to use the above code, but I am getting "Liferay.PortletURL is undefined".

Could anybody please help me, Does there any need to include liferay js files or any settings in portal-ext.properties to utilize liferay js.

Any help is really appreciated.

Thank you,
Sri
min huang
RE: How do I use Liferay JavaScript API?
March 18, 2013 6:58 PM
Answer

min huang

Rank: New Member

Posts: 16

Join Date: November 14, 2012

Recent Posts

Hi,

did you sovle this problem?if you done,pls share it to us,


Thanks!!
min huang
RE: How do I use Liferay JavaScript API?
October 28, 2013 1:01 AM
Answer

min huang

Rank: New Member

Posts: 16

Join Date: November 14, 2012

Recent Posts

HI All!


I have got a way to use liferay JS API,like this

1
2AUI().ready('liferay-portlet-url', function(A) {
3                    var renderURL = Liferay.PortletURL.createRenderURL();
4                    renderURL .setParameter("struts_action","/communities/edit_pages");
5                    renderURL .setParameter("groupId",value);
6                    renderURL.setPortletId('<%=themeDisplay.getPortletDisplay().getId()%>');
7                    alert(renderURL.toString());
8});
sri p
RE: How do I use Liferay JavaScript API?
September 10, 2013 12:24 PM
Answer

sri p

Rank: Junior Member

Posts: 79

Join Date: January 22, 2011

Recent Posts

I also used it in same way, I appreciate if there is a post about how to use AUI properly.
I see that AUI is based on YUI and they used advanced java script like modules and prototypial inheritance.

It would be really appreciated if some one could explain how to use AUI.

Thanks,
Sri
Atin Agarwal
RE: How do I use Liferay JavaScript API?
October 28, 2013 2:41 AM
Answer

Atin Agarwal

Rank: Junior Member

Posts: 78

Join Date: February 19, 2012

Recent Posts

Follow below links -

AlloyUI - Working with elements and events

GitHub - alloy ui demos

AlloyUI - 2.0

Regards,
Atin Agarwal