miercuri, 2 septembrie 2009

Richfaces and JQuery

Richface is a JSF based framework which offers a large collection of "ajax-enabled" components. These components use prototype javascript library. This is the main reason you have to be really careful when you want to use JQuery. I needed JQuery to create a photo gallery and combine it with dataScroller component. I was really surprised when I saw that dataScroller component was not working(page links were raising a javascript error). After I had searched for the cause of the issue and I had read the official guide from Exadel/RedHat I found out that JQuery must be imported using the following syntax:


<a4j:loadScript src="resource://jquery.js" />

In javascript functions you cand use jQuery(...) function instead of $(...). This solution make both javascript libraries, JQuery and prototype, work together.

Niciun comentariu:

Trimiteți un comentariu