Gravatar for david_tobin@bose.com

Question by dave tobin, Mar 3, 2015 2:32 PM

Line breaks not displaying in JSUI for custom field, works as expected in .NET

The Back-End: I have a custom field from a SharePoint list column (multi-line plain text). All of this is working correctly, and appears in the index browser.

The front end/Problem In the .NET interface, adding this field as a display field pulls in line breaks, and displays them as expected. In the JSUI, those line breaks are ignored. How can I get the JSUI to pay attention to those line breaks?

1 Reply
Gravatar for olamothe@coveo.com

Answer by olamothe, Mar 3, 2015 2:45 PM

Can you provide the template/code you are using in the JS UI to render your result ?

Have you tried outputting the field inside a <pre> tag in your template ?

Gravatar for david_tobin@bose.com

Comment by dave tobin, Mar 3, 2015 2:57 PM

So I didn't add anything to the default template, just the HTML search page itself. I did try pre, but with no luck.

Here's an excerpt of the code:

    <table class="CoveoFieldTable">
    <tr data-caption="Expertise" data-field="@Expertise"</tr>
    </table>
Gravatar for david_tobin@bose.com

Comment by dave tobin, Mar 3, 2015 3:06 PM

I had previously tried using a <pre> element and it didn't work. Based on the conversation, I added a white-space style tag to the <tr> element, and that solved it… Thanks for pointing me in the right direction…

    <table class="CoveoFieldTable">
       <tr style="white-space:pre;" data-caption="Expertise" data-field="@Expertise"></tr>
    </table>
Ask a question