+ Start a Discussion

How to display dynamic status icons in a datatable

Hi all, 


I have a datatable here where I would like to display the status of the objects, which is a simple string property, like this:


<apex:dataTable value="{!allStati}" var="stat" id="theTable" cellpadding="4" border="1">

... <apex:column headervalue="Status" value="{!stat.status}" />  ...



This works fine, if I just pass in the status as the string. However, I would like to display status icons instead of the string, so I have uploaded my icons to the static resources and I am now dynamically concatenating the status string in the getter, like this:


String url = '<img width="80" height="80" src="https://na2.salesforce.com/resource/1244040192000/';

if(status == 'Published')

url = url + 'icon_published" />';


url = url + 'icon_not_published" />'; 


Since this is standard HTML, I would have assumed that the table would now include the icon. What I get instead in the table is the url to the status icon in plain text form:


"<img width="80" height="80" src="https://na2.salesforce.com/resource/1244040192000/icon_published" />" 


How can I get the icons to display?





PS: If I use the apex:image tag instead of the standard HTML tag, I get the same results.