[英]target="_blank" in p:menuitem doesn't open new tab
我使用的是 primefaces 5.1、liferay 6.2.0-ga2 和 JSF2。 我有一個帶按鈕的頁面。 當我按右鍵單擊上下文菜單時,會顯示一個菜單項。 該菜單項必須打開一個新選項卡,但事實並非如此。
<p:commandButton id="viewUnassignedCase"
action="application-container" styleClass="icon fa fa-eye">
<f:setPropertyActionListener
target="#{applicationManagementBean.application}"
value="#{unassignedCase}" />
<f:setPropertyActionListener
target="#{applicationManagementBean.activeIndexTab}" value="0" />
</p:commandButton>
<p:contextMenu for="viewUnassignedCase" id="tableMenu"
widgetVar="tableMenu">
<p:menuitem value="#{caseList['caseManagement.case.newtab']}"
target="_blank"
action="#{applicationManagementBean.openNewTabDetail(unassignedCase)}">
</p:menuitem>
</p:contextMenu>
和豆
public String openNewTabDetail(final FlexibleDomain application)
{
setApplication(application);
return "application-container";
}
我該如何解決?
對於這種行為, Primefaces 的 GoogleCode上有一個標記為“Won'tFix”的問題(p:menuItem 不使用操作打開新窗口)。
在您的情況下,您需要將基於操作的導航調整為基於 url 的導航。
我真的不知道如何讓它在你的項目中工作,但我最好的辦法是嘗試這樣的事情:
<p:contextMenu for="viewUnassignedCase" id="tableMenu"
widgetVar="tableMenu">
<p:menuitem value="#{caseList['caseManagement.case.newtab']}"
target="_blank"
url="www.yoururl.com/yourdesiredpath">
</p:menuitem>
</p:contextMenu>
在最壞的情況下,您應該嘗試覆蓋 Primefaces 的 p:menuitem 默認行為,或者嘗試使用其他支持這種實現的組件。
祝你好運!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.