Any chance that changing:
<span tal:content="value">Value</span>
to
<span>${value}</span>
works ?
( or maybe
<span tal:replace="structure value" />
Any chance that changing:
<span tal:content="value">Value</span>
to
<span>${value}</span>
works ?
( or maybe
<span tal:replace="structure value" />
Sorry, my fault, try
tal:replace
instead of
tal:content
... and I didn't see the set()
When you use, tal:content
every output (-> value) will be seperated by (or whatever)
And if you want to use HTML-Tags in your ouput, you shoud structure your content -> Plone Docs: TAL Page Templates
This should work (could be more compressed, but should be readable and coherent):
<tal:cond tal:condition="python:field in ['dhhs_division']">
<tal:def define="field_data python:view.tabular_fielddata(item, field)">
<tal:cond tal:condition="field_data|nothing">
<tal:rep repeat="row field_data">
<tr tal:define="value row/value|nothing">
<tal:cond tal:condition="value">
<td tal:condition="python:isinstance(value, basestring)">
<span tal:replace="row/value"></span>
</td>
<td tal:condition="not:python:isinstance(value, basestring)">
<span tal:replace="structure python:'<br/>'.join(str(s) for s in value)" />
</td>
</tal:cond>
<tal:cond tal:condition="not:value">
<td>Empty</td>
</tal:cond>
</tr>
</tal:rep>
</tal:cond>
</tal:def>
</tal:cond>
Michael, thank you so much. Based on what you gave me. This is what I did:
<td tal:condition="python:field in ['dhhs_division']" tal:define="field_data python:view.tabular_fielddata(item, field)"> <tal:cond tal:condition="field_data|nothing"> <tal:rep repeat="row field_data"> <span tal:define="value row/value|nothing"> <tal:cond tal:condition="value"> <span tal:condition="python:isinstance(value, basestring)"> <span tal:replace="row/value"></span> </span> <span tal:condition="not:python:isinstance(value, basestring)"> <span tal:replace="structure python:'<br/>'.join(str(s) for s in value)" /> </span> </tal:cond> <tal:cond tal:condition="not:value"> <span>Empty</span> </tal:cond> </span> </tal:rep> </tal:cond> </td>
For some reason, I keep getting "Empty".
did you try my suggestion?
Remove that line
There must be some difference in the code we are talking about:
If you get some code that produces
Medical Assistance (DMA) <br /> Health Service Regulation (DHSR),
I am quite sure that just changing tal:content='xx' to tal:replace="structure xx" would work
Michael, I removed the "Empty" line and instead of getting the word "Empty" appearing in my table, they have been replaced by blank cells:
<td tal:condition="python:field in ['dhhs_division']" tal:define="field_data python:view.tabular_fielddata(item, field)"> <tal:cond tal:condition="field_data|nothing"> <tal:rep repeat="row field_data"> <span tal:define="value row/value|nothing"> <tal:cond tal:condition="value"> <span tal:condition="python:isinstance(value, basestring)"> <span tal:replace="row/value"></span> </span> <span tal:condition="not:python:isinstance(value, basestring)"> <span tal:replace="structure python:'<br/>'.join(str(s) for s in value)" /> </span> </tal:cond> </span> </tal:rep> </tal:cond> </td>
Espen, this is what I did. I replaced tal:content with tal:replace:
<td tal:condition="python:field in ['dhhs_division']" tal:define="field_data python:view.tabular_fielddata(item, field)"> <tal:block tal:repeat="k python:field_data.keys()"> <tal:define tal:define="value python:'\n'.join(field_data.get(k)) if isinstance(field_data.get(k), set) else field_data.get(k)"> <tal:cond tal:condition="value|nothing"> <span tal:replace="structure value">Value</span> </tal:cond> </tal:define> </tal:block> </td>
Results remained the same:
Row 1: Medical Assistance (DMA) Health Service Regulation (DHSR)
Row 2: Social Services (DSS)
Row 3: Blank
<td tal:condition="python:field in ['dhhs_division']"
tal:define="field_data python:view.tabular_fielddata(item, field)">
<tal:block tal:repeat="k python:field_data.keys()">
<tal:define tal:define="value python:'<br />'.join(field_data.get(k)) if isinstance(field_data.get(k), set) else field_data.get(k)">
<tal:cond tal:condition="value|nothing">
<span tal:replace="structure value">Value</span>
<span>Lets try this, too: ${value}</span>
</tal:cond>
</tal:define>
</tal:block>
Espen!!!! By George, I think you've got it!!!!! This is what I did (I removed the "Let's try this too" line):
<td tal:condition="python:field in ['dhhs_division']" tal:define="field_data python:view.tabular_fielddata(item, field)"> <tal:block tal:repeat="k python:field_data.keys()"> <tal:define tal:define="value python:'<br />'.join(field_data.get(k)) if isinstance(field_data.get(k), set) else field_data.get(k)"> <tal:cond tal:condition="value|nothing"> <span tal:replace="structure value">Value</span> <!--span>Lets try this, too: ${value}</span--> </tal:cond> </tal:define> </tal:block> </td>
Results are showing:
Row 1 (displaying in two rows): Medical Assistance (DMA)
Health Service Regulation (DHSR)
Row 2: Social Services (DSS)
Row 3: Blank
THANK YOU SO MUCH!!!!
Espen, Michael and gp54321, thank you so much for your patience and help. They are very much appreciated!!!! THANK YOU!!!!
Cheers,
Angela