开发者

jQuery Plugins Not working in Richfaces 4

I'm trying to create a modal popup in jQuery in JSF 2开发者_运维百科.0 / Richfaces 4 Application. jQuery works fine as is, say $('#myDiv').css. But jQuery plugins fail like $.blockUI(); I get the error message, the object does not support his property or value.

jQuery Version : 1.4.4

Thanks, SKR


The below worked
1.The jQuery plugin was put into WebContent\resources folder
2.The plugin was included using into the body of the page NOT the head.


Take a look at the following link: http://community.jboss.org/message/576568#576568

jQueryPlugin component. Currently only available for RF 3.3.3 as a sandbox component and not RF 4 so probably doesn't help you much now.

A possible workaround taken from this thread that led to the jQueryPlugin component would be:

RichFaces 3.3.3-Final ship with jQuery 1.3.2. When you include rich:jQuery component in your page the automatically jquery.js script is being loaded. If you want to use custom plugins then you need to include that rich:jQuery component and load your plugin from within body but not from head, cause you don't have any guarantee on order of scripts there.

I know it is based on RF 3.3.3 but I think the same applies for RF 4. The thread has some more helpful information that is worth reading.


But to clearly maintain the clean code, I recommend to use your own variable such as jQuery or myJquery instead of $, because rich-faces uses this as different variable and you may have conflicts in future for maintainability.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜