1
我有一個primefaces(5.1)的數據表與在rightermost列一些按鈕:做可能打開號碼:按Ctrl新窗口按鈕+單擊或Middleclick類似鏈接
<p:column headerText="Actions" style="width: 60px">
<p:button id="uploadButton" title="upload files"
icon="fa fa-edit" outcome="uploadFilesToVersion">
<f:param name="versionId" value="#{version.id}" />
</p:button>
<!-- other buttons come here-->
</p:column>
注意,「版本」是sourrounding p:dataTable和uploadFilesToVersion.xhtml的本地(循環)變量是用戶上傳文件到id = version.id的「版本」的視圖)
請注意,按鈕doeas不會調用任何bean方法,我只是使用了它的風格的p:button元素。現在我想讓用戶可以在新的瀏覽器標籤/窗口中打開按鈕的結果(即URL)。這將是有益的,因爲我想同時保留dataTable的過濾器狀態(當用戶在瀏覽器中單擊「後退」時丟失它)。
那怎麼可以實現?
編輯:當然,人們可以使用一些CSS來模擬天生一個按鈕的外觀,但我想避免這種情況:
<p:column headerText="Actions" style="width: 60px">
<p:link id="uploadButton" title="upload files"
outcome="uploadFilesToVersion"
styleClass="ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only">
<span class="ui-button-icon-left ui-icon ui-c fa fa-edit"></span>
<span class="ui-button-text ui-c">ui-button</span>
<f:param name="versionId" value="#{version.id}" />
</p:link>
<!-- other buttons come here-->
</p:column>
'wanted'是過去時。所以你改變了主意? – Kukeltje
是的,根據BalusC的回答我「改變了主意」,所以說 –
所以編輯是一種額外的答案?然後發佈它,或者由BalusC'編輯'答案並將其添加到那裏,以便參數的傳遞也在那裏(並且請發佈PF版本信息) – Kukeltje