Foren

EXTJS JAVASCRIPT Portlet

Gassara Amin, geändert vor 16 Jahren.

EXTJS JAVASCRIPT Portlet

New Member Beiträge: 5 Beitrittsdatum: 05.08.07 Neueste Beiträge
I would like to use EXTJS javascript library to developp a personnel war portlet So I integrate all library in my application and i importe the .js file in my view.jsp ant in the liferay_portlet.xml but it not work in the portal so please can You help Me thanks
thumbnail
Roman Hoyenko, geändert vor 16 Jahren.

RE: EXTJS JAVASCRIPT Portlet

Liferay Master Beiträge: 878 Beitrittsdatum: 08.10.07 Neueste Beiträge
The problem is most likely with the path, here is how I importl js files:

<%@ include file="/pages/clientAccess/ajax.js" %>

where js is in /pages/clientAccess/ directory in the war file. In this case you need to put


tags in the js file.

Another way to import:

/pages/clientAccess/treeview-min.js">

You need to import portlet tag library and initialize it:

<%@taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
<portlet:defineObjects />

to be able to access renderRequest object.
Alex Kudinov, geändert vor 16 Jahren.

RE: EXTJS JAVASCRIPT Portlet

Junior Member Beiträge: 31 Beitrittsdatum: 14.01.08 Neueste Beiträge
how do you avoid loading same js file twice if you have two instances of the same portlet on the same page?

Thanks!
thumbnail
Ray Auge, geändert vor 16 Jahren.

RE: EXTJS JAVASCRIPT Portlet

Liferay Legend Beiträge: 1197 Beitrittsdatum: 08.02.05 Neueste Beiträge
In your liferay-portlet(-ext).xml file, simply add:

<header-portal-javascript>/path/to/file/relative/to/your/portlet/context/path.(js|jsp)</header-portal-javascript>


Notice it's called header-portal-javascript, implying that it will be loaded into the portal header (but only when it's on the page, and it won't add the same file twice).

For more details on all these kinds of Liferay goodies, have a look at the liferay-portlet DTD for the version of the portal you're using.

Hope that helps!
Alex Kudinov, geändert vor 16 Jahren.

RE: EXTJS JAVASCRIPT Portlet

New Member Beiträge: 5 Beitrittsdatum: 17.01.08 Neueste Beiträge
I saw those settings, but if I have same script library called from both portlets and they both declare this header - wouldn't it defeat the whole purpose? Or liferay would weed out double entries?

The problem is that these porlets should work both independently and together on the same page. In the first case there is no problem - my js file is getting loaded once. What should i do about the second case?

Can we add some script to the page itself? I saw a JavaScript setting on the page properties page, but it didn't seem work for me. What do I do there? Just paste script? Including <script> tag or not?

Thanks!