Primefaces 10 HTML styling in DataTable emptyMessage

379 Views Asked by At

I want to add html styled message for empty datatable in Primefaces 10 (emptyMessage property). Something like "Hello world!" (notice bold word world!) I use PropertyResourceBundle with message.properties properties file to load message. I tried something like this in 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>
1

There are 1 best solutions below

0
Melloware On BEST ANSWER

You can do it instead with emptyMessage facet and escape="false" like this...

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