I am iterating a list and displaying the data in the DataTable. However, The list has the objects with the boolean values. I want to display some string value depending on the boolean value in the datatable.
I tried to implement the customized convertor as below. However, my convertor doesn't get called. I don't see any error in the log too. Can someone please suggest if I am doing any wrong.
It's not usually worth the trouble to build a converter for boolean displays. It's easier to just provide 2 outputTexts, one for true and one for false and switch them on and off by their "rendered" attributes:
As far as your converter is concerned, I don't see anything wrong, so it may be you mis-capitalized something or made some other non-obvious mistake in the specs.
An IDE is no substitute for an Intelligent Developer.
Joined: Aug 24, 2011
Tim Holloway wrote:It's easier to just provide 2 outputTexts
Also, you can use <h:panelGroup rendered="boolean"> to hide or display a bundle of objects(links,forms,messages,ui:repeats).
Joined: Sep 17, 2008
Thank you all.
I have some scenarios wherein I need to make the Convertor implementation working in my project. For this scenario, I dropped the idea to use Convertor. I replaced the properties in the bean from boolean to String and managed to set the values 'X' and empty string in the bean itself.
The idea to use the boolean value for rendered attribute was good. However, this doesn't applies to my case. In my case I am iterating a list and displaying the data in DataTable.
So rendered attribute will not help here.
I am still fighting with getting the convertor working for one more scenario. Here is my situation, while iterating the list, if the data for the property is null, I have to keep the column empty,however, if it is not null value I have to display as '*'.
Does the <f: Covertor> works in datatable?
Could you give me some specific pointers to cross check?
Joined: Sep 17, 2008
Could some one help me out with this, please?
subject: How to display text using outputText conditionally in the DataTable