[ 
https://issues.jboss.org/browse/RF-11144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12653718#comment-12653718
 ] 

Lutz Ulrich commented on RF-11144:
----------------------------------

I'm using PrimeFaces along with RichFaces, too, and have the same problem.

In order to avoid such conflicts, RichFaces' jquery.js (and all jquery.js files 
of other JSF libraries) should contain a test which checks if jquery has 
already been initialized. 
That is, check for example, if the variables window.$ or window.jquery are 
already defined.

A workaround is to 'override' RichFaces' version of jquery.js.

RichFaces jquery.js is integrated into the HTML document via:

<script type="text/javascript" 
src="/oswebjsf2/javax.faces.resource/jquery.js.faces"></script>

It is loaded from 
richfaces-core-impl-<version>.jar/META-INF/resources/jquery.js .

If the web app's folder resources/ contains a file with the same name, that 
resource file will be loaded instead of the one in 
richfaces-core-impl-<version>.jar, because files in the web app's resources 
folder have a higher priority than files in JARs.

One can copy RichFaces jquery.js from richfaces-core-impl-<version>.jar into 
the web app's resources/ folder. In that copy, one can add additional code 
which checks if jquery has already been initialized:

(function( window, undefined ) {

// THE TEST:
if (!window.$) {

// ...

window.jQuery = window.$ = jQuery;
} // end test if window.$ 
})(window);

  
                
> Add the possibility to configure which jquery version RF will use.
> ------------------------------------------------------------------
>
>                 Key: RF-11144
>                 URL: https://issues.jboss.org/browse/RF-11144
>             Project: RichFaces
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>          Components: compatibility, third-party
>            Reporter: José Freitas
>              Labels: integration, jquery, primefaces
>             Fix For: 4.Future
>
>
> This feature would be awesome cause it could easy integration with others 
> components suites like primefaces.
> if we could say to richfaces where it could  find its jquery reference, we 
> could config it to use jquery from primefaces for example.
> <h:outputScript library="primefaces" name="jquery/jquery.js" />
> avoiding jquery double loading and conflicts between libs.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

_______________________________________________
richfaces-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/richfaces-issues

Reply via email to