【发布时间】:2013-11-09 21:08:46
【问题描述】:
当<p:dataTable> 中的一行被右键单击时,<p:contextMenu> 会出现一个删除选项。单击此选项时,<p:confirmDialog> 将出现两个按钮 Yes 和 No - 关于删除当前行的配置警告如下。
<p:contextMenu for="dataTable">
<p:menuitem oncomplete="confirmDelete.show()"
value="Delete"
update="confirmDialog"
process="@this dataTable"
actionListener="#{testManagedBean.deleteActionListener}"
icon="ui-icon-close" ajax="true"/>
</p:contextMenu>
<p:confirmDialog id="confirmDialog"
widgetVar="confirmDelete"
message="#{testManagedBean.message}"
header="Message"
severity="alert"
closeOnEscape="true"
showEffect="slide"
hideEffect="fold"
appendTo="@(body)"
closable="true">
<p:commandButton id="btnYes"
value="Yes"
process="@this"
oncomplete="confirmDelete.hide()"
actionListener="#{testManagedBean.deleteActionListener}"
update="dataTable"/>
<p:commandButton id="btnNo"
value="No"
onclick="confirmDelete.hide()"
type="button" />
</p:confirmDialog>
有没有办法在此对话框上设置带有格式化消息的message 属性。
例如,其托管 bean 中的属性 testManagedBean.message 设置为类似字符串
You are about to delete <font color='#ff0000'>2</font> rows. <br/>This action will never be undone. <br/>Are you sure?
确认对话框将这个字符串显示为一个整体。此字符串中的 HTML 应被解释为 HTML。我在<p:confirmDialog> 中没有看到像escape 这样的属性。
有没有办法将此字符串显示为格式化消息。
【问题讨论】:
标签: jsf primefaces jsf-2.2