2
votes

Sometimes Xpages drives me insane. So many easy things (things that should be easy anyway) are hard.

Simple questions, how do I display multi-value fields with new line in Xpages view Column?

2
Check out Serdar's answer here ... stackoverflow.com/questions/24934656/…Paul Della-Nebbia
I like this way. Works great. Thanks.Bryan Schmiedeler

2 Answers

4
votes

There's ways to do it with computed controls, where you explode the array and add a
and stuff like that.

Personally I like to just use a repeat control. Set the field as the repeat value. Add a computed control for the "rowData" and add a
if you want a new line between each of them. I'm sure I did this on an early NotesIn9 though I forget which one at the moment.

the key is this. a Repeat control can repeat or "iterate" over any type of array or "multi-value" object.

1
votes

It's always better and easy to use view control for categorized views rather than repeat controls. To display multi-value field in view column you have to set content type as HTML then just replace commas with <br> tag. And it works exactly as you want.

<xp:viewColumn columnName="$3" id="viewColumn3" contentType="html">
    <xp:this.converter>
        <xp:customConverter getAsObject="#{javascript:value}">
            <xp:this.getAsString><![CDATA[#{javascript:@Implode(value, '<br>')}]]></xp:this.getAsString>
        </xp:customConverter>
    </xp:this.converter>
    <xp:viewColumnHeader value="ColumnHeader" id="viewColumnHeader3">
    </xp:viewColumnHeader>
</xp:viewColumn>