<% if (m.col.pre_value_microtemplate) { %>
	{{m.lib.microTemplate(m.col.pre_value_microtemplate, m)}}
<% } %>
<% if (m.col.pre_value_html) { %>
	{{m.col.pre_value_html}}
<% } %>


<% var b, val = m.item[m.col.id], isSet = zenario.defined(val) && val !== ""; %>
<% if (b = m.item.__columnButtons && m.item.__columnButtons[m.col.id]) { %>
	<a
		title="{{b.tooltip|escape}}"
	
		<% if (b._isDisabled) { %>
			class="zfea_link_on_column zfea_link_on_column_disabled {{b.css_class|escape}}"
	
		<% } else { %>
			class="zfea_link_on_column {{b.css_class|escape}}"
		
			<% if (b.href) { %>
				href="{{b.href|escape}}"
			
				<% if (b.new_window) { %>
					target="_blank"
				<% } %>
			<% } %>
		
			<% if (b.onclick && !(b.href && b.new_window)) { %>
				onclick="{{b.onclick|escape}}"
			<% } %>
		<% } %>
	>
<% } %>


<% if (m.col.sparkline) { %>
	{% m.lib.hadSparkline = true; %}

<% } else if (m.col.microtemplate) { %>
	{{m.lib.microTemplate(m.col.microtemplate, m)}}

<% } else if ((m.col.html || m.col.twig_snippet) && !m.col.convert_to_percentage_of_total) { %>
	{{val}}

<% } else if (m.col.is_icon) { %>
	<span class="fea_icon {{val|escape}}"></span>
    
<% } else if (val && m.col.values && m.col.show_multiple_values) { %>
	<span class="fea_multiple_values">
		<% foreach (('' + val).split(',') as var fi => var frag) { %>
			<% frag = $.trim(frag); %>
			
			<% if (zenario.defined(m.col.values[frag])) { %>
				<span class="fea_value fea_known_value">{{zenarioT.valueLabel(m.col.values[frag])|escape}}</span>
			<% } else { %>
				<span class="fea_value fea_unknown_value">{{frag|escape}}</span>
			<% } %>
		<% } %>
	</span>
    
<% } else if (val && m.col.values && m.col.values[val]) { %>
	<span class="fea_value fea_single_value fea_known_value">{{zenarioT.valueLabel(m.col.values[val])|escape}}</span>

<% } else if (m.col.convert_to_percentage_of_total && m.lib.pcOfTotal[m.col.id] && isSet) { %>
	{{zenario.round(100 * val / m.lib.pcOfTotal[m.col.id], 1)}} %

<!--
	If a column is empty, and the column has an empty value defined,
	then show the empty value
-->
<% } else if (!val && m.col.empty_value) { %>
	<span class="fea_empty_value">{{m.col.empty_value|escape}}</span>
    
<!--
	Show a CSS class name when you define a LoV, but a specific value is not in the LoV, and is just being displayed as-is.
-->
<% } else if (val && m.col.values) { %>
	<span class="fea_value fea_single_value fea_unknown_value">{{val|escape}}</span>

<!--
	Watch out for columns that should be date-formated
-->
<% } else if (val && (m.col.format || m.col.type) == 'date') { %>
	<span class="fea_date">{{zenario.formatDate(val, false, m.lib.defaultDatePickerFormat())|escape}}</span>
<% } else if (val && (m.col.format || m.col.type) == 'datetime') { %>
	<span class="fea_datetime">{{zenario.formatDate(val, true, m.lib.defaultDatePickerFormat())|escape}}</span>

<!--
	Otherwise, just display the value of the column
-->
<% } else { %>
	{{val|escape}}<% if (isSet && m.col.units) { %><label class="fea_post_field_label">{{m.col.units|escape}}</label><% } %>
<% } %>


<% if (b) { %>
	</a>
<% } %>


<% if (m.col.post_value_html) { %>
	{{m.col.post_value_html}}
<% } %>
<% if (m.col.post_value_microtemplate) { %>
	{{m.lib.microTemplate(m.col.post_value_microtemplate, m)}}
<% } %>
