简体   繁体   中英

Primefaces Datatable Value as Checkbox Itemlabel

I am very new to java. In primefaces datatable, I'm trying to display "checkbox itemlabel" instead of "value". Here is my code;

<p:column headerText="Person Type" ><h:outputText value="#{persontbl.typeprs}" /></p:column>

#{persontbl.typeprs} holds "True" or "False" (checkbox). With this code in datatable, naturally I see the row value as "False" or "True".

But I want to see as "Customer" if true , ""( blank ) if false .

In previous (save) page, my checkbox is as below;

<p:selectBooleanCheckbox value="#{persontbl Service. persontbl.typeprs }" itemLabel="Customer" />

只需将输出更改为...非常简单

<h:outputText value="#{persontbl.typeprs ? 'Customer' : ''}" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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