简体   繁体   English

DataTable emptyMessage 中的 Primefaces 10 HTML 样式

[英]Primefaces 10 HTML styling in DataTable emptyMessage

I want to add html styled message for empty datatable in Primefaces 10 (emptyMessage property).我想在 Primefaces 10(emptyMessage 属性)中为空数据表添加 html 样式的消息。 Something like "Hello world! " (notice bold word world!) I use PropertyResourceBundle with message.properties properties file to load message.像“Hello world! ”(注意粗体字世界!)我使用 PropertyResourceBundle 和 message.properties 属性文件来加载消息。 I tried something like this in message.properties:我在 message.properties 中尝试过这样的事情:

grap.noData.text=Hello <b>world!</b>

but it didn't work但它没有用

<p:dataTable id="grapTable" var="row"
            value="#{grController.graphics}"
            emptyMessage="#{grController.editAllowed ? msg['grap.noData.text'] : msg['grap.noData.readOnly.text']}"></p:dataTable>

You can do it instead with emptyMessage facet and escape="false" like this...您可以使用emptyMessage facet 和escape="false"来代替,像这样...

<f:facet name="emptyMessage">
  <h:outputText 
     escape="false" 
     value="#{grController.editAllowed ? msg['grap.noData.text'] : msg['grap.noData.readOnly.text']}" />
</f:facet>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM