簡體   English   中英

使用primefaces訪問Jquery UI

[英]Access Jquery UI using primefaces

我正在構建一個JSF應用程序,並希望將一個簡單的h:link轉換為使用jquery ui button widget的按鈕。 我正在使用JSF2和primefaces 3.5。

我手動添加了jquery-ui.js並擁有以下xhtml:

<h:link styleClass="linkGr" outcome="#{listadoUsuario.verUser(user.username)}">ver</h:link>
<script>$(".linkGr").button({icons: {primary: "ui-icon-pencil"},text: false});</script>

在頁面中有這個工作正常,但在其他頁面中,我看到以下錯誤:

TypeError: Object function (f,h,e){var g=f.split(".")[0],j;f=f.split(".")[1];j=g+"-"+f;if(!e){e=h;h=b.Widget}b.expr[":"][j]=function(k){return !!b.data(k,f)};b[g]=b[g]||{};b[g][f]=function(k,l){if(arguments.length){this._createWidget(k,l)}};var i=new h();i.options=b.extend(true,{},i.options);b[g][f].prototype=b.extend(true,i,{namespace:g,widgetName:f,widgetEventPrefix:b[g][f].prototype.widgetEventPrefix||f,widgetBaseClass:j},e);b.widget.bridge(f,b[g][f])} has no method 'extend'

我注意到這發生在primefaces添加jquery-plugins.js的頁面中。

我試圖手動不包括jquery-ui javascript,因為我看到jquery-plugins添加了按鈕小部件,但問題是在添加jquery-plugins(不包括jquery-ui.js)時我看不到如何將鏈接轉換為按鈕。 功能按鈕在$中不可用。 有人可以指導我如何使用包括按鈕方法的primefaces?

提前致謝!

PrimeFaces已經整合了jQuery UI,你不應該自己捆綁它。 p:button組件。 以下是Primefaces Showcase的示例。 所以對於你的情況:

<p:button outcome="#{listadoUsuario.verUser(user.username)}" value="ver" icon="ui-icon-pencil"/>   

您可以使用

 <f:param name="productId" value="10" /> 

如果您需要在URL中使用GET參數。

另見: https//stackoverflow.com/a/18916907/2692917

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM