I've a PrimeFaces web application. When I manually add jQuery and plugins like below,
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/onebyone/jquery.onebyone.js"></script>
<script type="text/javascript" src="js/onebyone/jquery.touchwipe.min.js"></script>
<script type="text/javascript" src="js/jquery.carouFredSel-5.5.0.js"></script>
then PrimeFaces components loose their functionality and some of their styles. For example, <p:dialog>
don't show up, <p:accordionPanel>
doesn't slide, <p:panelGrid>
loses padding, etcetera.
How is this caused and how can I solve it?
EDIT 2: I ran a manual debug and found out that this line was causing the trouble, and after removing it, things got back to normal hopefully.
I wasn't actually getting any errors or excretions but some primeface components were acting weird. For example I have a
selectOneMenu
component defined with a converter. When one item is selected the form gets updated via Ajax. The problem was after selecting an item the menu items got broken (they were representing numbers instead of text) as if somehow the converter wasn't working and the other commands of the page stooped functioning (were not doing anything).Another problem was
datatable
component where each row has a commandlink which triggers some Ajax behavior. After the links are clicked the pagination of datatable wasn't working.From these issues I assumed that there is a conflict between jQuery and ajax.
Although its a very large file, If anyone is interested this is the content of the js file that was causing the troubles
Regards
PrimeFaces already ships with jQuery bundled, yet you've downloaded and installed another one which would only conflict with PrimeFaces bundled jQuery. I'm sure that if you have paid a bit more attention and love to the webbrowser's builtin JavaScript console, you would have seen JS errors. And, if you checked the JSF-generated HTML output via rightclick, View Source in webbrowser, you would have seen another
jquery.js
file being included in HTML<head>
.You need to remove the following line:
In case you have pages which do not necessarily use PrimeFaces components, and thus its jQuery wouldn't automatically be included, then you'd need to explicitly load its bundled jQuery by a proper
<h:outputScript>
.Note that using
<h:outputScript>
does not end up in a duplicate script include on pages which actually use PrimeFaces components.See also: