FeinesFabi
FeinesFabi

Reputation: 1207

Can't get jQuery to work with Icefaces + Liferay

I'm trying to develop a simple Liferay portlet with the Icefaces framework and cannot get jQuery to work.

The main problem is, that I can't load the jQuery library properly. Whenever I add script tags to my xhtml header like this

<h:head>
    <script></script>
</h:head>

the page shows an error message:

failed to append text[ ] into #document

So I tried loading the jQuery libray with the h:outputScript tag instead, but in Icefaces, the target="head" option doesn't work - see http://jira.icesoft.org/browse/ICE-8313.

<h:outputScript library="scripts" name="jquery-1.9.1.js" target="head" />

So, at this point I'm clueless who to include the jQuery (or any javascript) library.

Please don't suggest using another framework. Icefaces is demanded in future projects, so I have to get used to it.

All I'm trying to do is something like this: http://jqueryui.com/sortable/

Thanks in advance, Fabi.

Upvotes: 1

Views: 690

Answers (2)

Prakash K
Prakash K

Reputation: 11698

I hope you know that this <h:head> tag would ultimately generate an HTML <head> tag.

And since portlets are just fragments they should not contain any type of <head> tag, so in liferay you can specify your javascript either in <header-portlet-javascript> or <header-portal-javascript> element in liferay-portlet.xml.

Or else include your javscript library in the theme you would create inside the portal_normal.vm.

Upvotes: 3

Eich
Eich

Reputation: 3788

You can import a JS-Library with the <header-portlet-javascript> in the liferay-portlet.xml file. Maybe this (older) example can help you.

Upvotes: 0

Related Questions